Skip to content

Commit 95c493f

Browse files
pulsejetnextcloud-command
authored andcommitted
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> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent cd6b10f commit 95c493f

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
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
*/

dist/files-sidebar.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-sidebar.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)