Skip to content

Commit c581024

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 <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent 5d669ab commit c581024

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

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
*/

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)