Skip to content

Commit

Permalink
sidebar: allow turning off tags view by default
Browse files Browse the repository at this point in the history
With #37065, there is no way to hide the tags from the sidebar
by default when they are not relevant or redundant (e.g. the tab
may already show the file's tags). This can be annyoing especially
when the file has many tags. This patch adds an option to hide
the tags from the sidebar by default (the user can still open
the tags tab manually).

This also reduces one request when opening the sidebar when the
tags are turned off, since all tags don't need to be fetched
anymore.

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
pulsejet authored and nextcloud-command committed Nov 27, 2023
1 parent 5d669ab commit c581024
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/files/src/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ window.addEventListener('DOMContentLoaded', function() {
window.OCA.Files.Sidebar.open = AppSidebar.open
window.OCA.Files.Sidebar.close = AppSidebar.close
window.OCA.Files.Sidebar.setFullScreenMode = AppSidebar.setFullScreenMode
window.OCA.Files.Sidebar.setShowTagsDefault = AppSidebar.setShowTagsDefault
})
14 changes: 12 additions & 2 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<!-- TODO: create a standard to allow multiple elements here? -->
<template v-if="fileInfo" #description>
<div class="sidebar__description">
<SystemTags v-if="isSystemTagsEnabled"
<SystemTags v-if="isSystemTagsEnabled && showTagsDefault"
v-show="showTags"
:file-id="fileInfo.id"
@has-tags="value => showTags = value" />
Expand Down Expand Up @@ -138,6 +138,7 @@ export default {
// reactive state
Sidebar: OCA.Files.Sidebar.state,
showTags: false,
showTagsDefault: true,
error: null,
loading: true,
fileInfo: null,
Expand Down Expand Up @@ -455,7 +456,7 @@ export default {
* Toggle the tags selector
*/
toggleTags() {
this.showTags = !this.showTags
this.showTagsDefault = this.showTags = !this.showTags
},

/**
Expand Down Expand Up @@ -529,6 +530,15 @@ export default {
}
},

/**
* Allow to set whether tags should be shown by default from OCA.Files.Sidebar
*
* @param {boolean} showTagsDefault - Whether or not to show the tags by default.
*/
setShowTagsDefault(showTagsDefault) {
this.showTagsDefault = showTagsDefault
},

/**
* Emit SideBar events.
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

0 comments on commit c581024

Please sign in to comment.