Skip to content

Commit 3980aa5

Browse files
committed
sidebar: allow turning off tags view by default
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 <[email protected]>
1 parent a21d6c5 commit 3980aa5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

apps/files/src/sidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ window.addEventListener('DOMContentLoaded', function() {
6161
window.OCA.Files.Sidebar.open = AppSidebar.open
6262
window.OCA.Files.Sidebar.close = AppSidebar.close
6363
window.OCA.Files.Sidebar.setFullScreenMode = AppSidebar.setFullScreenMode
64+
window.OCA.Files.Sidebar.setShowTagsDefault = AppSidebar.setShowTagsDefault
6465
})

apps/files/src/views/Sidebar.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<!-- TODO: create a standard to allow multiple elements here? -->
3838
<template v-if="fileInfo" #description>
3939
<div class="sidebar__description">
40-
<SystemTags v-if="isSystemTagsEnabled"
40+
<SystemTags v-if="isSystemTagsEnabled && showTagsDefault"
4141
v-show="showTags"
4242
:file-id="fileInfo.id"
4343
@has-tags="value => showTags = value" />
@@ -124,6 +124,7 @@ export default {
124124
// reactive state
125125
Sidebar: OCA.Files.Sidebar.state,
126126
showTags: false,
127+
showTagsDefault: true,
127128
error: null,
128129
loading: true,
129130
fileInfo: null,
@@ -441,7 +442,7 @@ export default {
441442
* Toggle the tags selector
442443
*/
443444
toggleTags() {
444-
this.showTags = !this.showTags
445+
this.showTagsDefault = this.showTags = !this.showTags
445446
},
446447
447448
/**
@@ -515,6 +516,15 @@ export default {
515516
}
516517
},
517518
519+
/**
520+
* Allow to set whether tags should be shown by default from OCA.Files.Sidebar
521+
*
522+
* @param {boolean} showTagsDefault - Whether or not to show the tags by default.
523+
*/
524+
setShowTagsDefault(showTagsDefault) {
525+
this.showTagsDefault = showTagsDefault
526+
},
527+
518528
/**
519529
* Emit SideBar events.
520530
*/

0 commit comments

Comments
 (0)