Skip to content

Commit 424eb12

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 <varunpatil@ucla.edu>
1 parent 5d669ab commit 424eb12

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
@@ -59,4 +59,5 @@ window.addEventListener('DOMContentLoaded', function() {
5959
window.OCA.Files.Sidebar.open = AppSidebar.open
6060
window.OCA.Files.Sidebar.close = AppSidebar.close
6161
window.OCA.Files.Sidebar.setFullScreenMode = AppSidebar.setFullScreenMode
62+
window.OCA.Files.Sidebar.setShowTagsDefault = AppSidebar.setShowTagsDefault
6263
})

apps/files/src/views/Sidebar.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<!-- TODO: create a standard to allow multiple elements here? -->
3737
<template v-if="fileInfo" #description>
3838
<div class="sidebar__description">
39-
<SystemTags v-if="isSystemTagsEnabled"
39+
<SystemTags v-if="isSystemTagsEnabled && showTagsDefault"
4040
v-show="showTags"
4141
:file-id="fileInfo.id"
4242
@has-tags="value => showTags = value" />
@@ -138,6 +138,7 @@ export default {
138138
// reactive state
139139
Sidebar: OCA.Files.Sidebar.state,
140140
showTags: false,
141+
showTagsDefault: true,
141142
error: null,
142143
loading: true,
143144
fileInfo: null,
@@ -455,7 +456,7 @@ export default {
455456
* Toggle the tags selector
456457
*/
457458
toggleTags() {
458-
this.showTags = !this.showTags
459+
this.showTagsDefault = this.showTags = !this.showTags
459460
},
460461
461462
/**
@@ -529,6 +530,15 @@ export default {
529530
}
530531
},
531532
533+
/**
534+
* Allow to set whether tags should be shown by default from OCA.Files.Sidebar
535+
*
536+
* @param {boolean} showTagsDefault - Whether or not to show the tags by default.
537+
*/
538+
setShowTagsDefault(showTagsDefault) {
539+
this.showTagsDefault = showTagsDefault
540+
},
541+
532542
/**
533543
* Emit SideBar events.
534544
*/

0 commit comments

Comments
 (0)