summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorRomulus Urakagi Tsai <urakagi@gmail.com>2019-08-07 07:58:05 +0000
committerRomulus Urakagi Tsai <urakagi@gmail.com>2019-08-07 07:58:05 +0000
commit4f4e0a21f80019048aad6b7a679899c048cb3865 (patch)
treeb891aa2e6a7dfaa84fc9ceefde15f6b44fa9efcf /client
parentcf9ad221f8654f070a2a7bb1de4522e4b01762dd (diff)
downloadwekan-4f4e0a21f80019048aad6b7a679899c048cb3865.tar.gz
wekan-4f4e0a21f80019048aad6b7a679899c048cb3865.tar.bz2
wekan-4f4e0a21f80019048aad6b7a679899c048cb3865.zip
Add 'show archive' and 'hide empty lists' in filter feature.
Diffstat (limited to 'client')
-rw-r--r--client/components/sidebar/sidebarArchives.js2
-rw-r--r--client/components/sidebar/sidebarFilters.jade16
-rw-r--r--client/components/sidebar/sidebarFilters.js19
-rw-r--r--client/components/swimlanes/swimlanes.jade3
-rw-r--r--client/components/swimlanes/swimlanes.js18
-rw-r--r--client/lib/filter.js4
6 files changed, 60 insertions, 2 deletions
diff --git a/client/components/sidebar/sidebarArchives.js b/client/components/sidebar/sidebarArchives.js
index 53fc29b9..a4846561 100644
--- a/client/components/sidebar/sidebarArchives.js
+++ b/client/components/sidebar/sidebarArchives.js
@@ -1,3 +1,4 @@
+archivedRequested = false;
const subManager = new SubsManager();
BlazeComponent.extendComponent({
@@ -12,6 +13,7 @@ BlazeComponent.extendComponent({
const currentBoardId = Session.get('currentBoard');
if (!currentBoardId) return;
const handle = subManager.subscribe('board', currentBoardId, true);
+ archivedRequested = true;
Tracker.nonreactive(() => {
Tracker.autorun(() => {
this.isArchiveReady.set(handle.ready());
diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade
index f11528b1..55ab213a 100644
--- a/client/components/sidebar/sidebarFilters.jade
+++ b/client/components/sidebar/sidebarFilters.jade
@@ -56,6 +56,22 @@ template(name="filterSidebar")
if Filter.customFields.isSelected _id
i.fa.fa-check
hr
+ ul.sidebar-list
+ li(class="{{#if Filter.archive.isSelected _id}}active{{/if}}")
+ a.name.js-toggle-archive-filter
+ span.sidebar-list-item-description
+ | {{_ 'filter-show-archive'}}
+ if Filter.archive.isSelected _id
+ i.fa.fa-check
+ hr
+ ul.sidebar-list
+ li(class="{{#if Filter.hideEmpty.isSelected _id}}active{{/if}}")
+ a.name.js-toggle-hideEmpty-filter
+ span.sidebar-list-item-description
+ | {{_ 'filter-hide-empty'}}
+ if Filter.hideEmpty.isSelected _id
+ i.fa.fa-check
+ hr
span {{_ 'advanced-filter-label'}}
input.js-field-advanced-filter(type="text")
span {{_ 'advanced-filter-description'}}
diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js
index 88438a7a..3483d00c 100644
--- a/client/components/sidebar/sidebarFilters.js
+++ b/client/components/sidebar/sidebarFilters.js
@@ -1,3 +1,5 @@
+const subManager = new SubsManager();
+
BlazeComponent.extendComponent({
events() {
return [
@@ -12,6 +14,23 @@ BlazeComponent.extendComponent({
Filter.members.toggle(this.currentData()._id);
Filter.resetExceptions();
},
+ 'click .js-toggle-archive-filter'(evt) {
+ evt.preventDefault();
+ Filter.archive.toggle(this.currentData()._id);
+ Filter.resetExceptions();
+ const currentBoardId = Session.get('currentBoard');
+ if (!currentBoardId) return;
+ subManager.subscribe(
+ 'board',
+ currentBoardId,
+ Filter.archive.isSelected(),
+ );
+ },
+ 'click .js-toggle-hideEmpty-filter'(evt) {
+ evt.preventDefault();
+ Filter.hideEmpty.toggle(this.currentData()._id);
+ Filter.resetExceptions();
+ },
'click .js-toggle-custom-fields-filter'(evt) {
evt.preventDefault();
Filter.customFields.toggle(this.currentData()._id);
diff --git a/client/components/swimlanes/swimlanes.jade b/client/components/swimlanes/swimlanes.jade
index 485b2ffc..3ad43777 100644
--- a/client/components/swimlanes/swimlanes.jade
+++ b/client/components/swimlanes/swimlanes.jade
@@ -33,7 +33,8 @@ template(name="listsGroup")
+addListForm
else
each lists
- +list(this)
+ if visible this
+ +list(this)
if currentCardIsInThisList _id null
+cardDetails(currentCard)
if currentUser.isBoardMember
diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js
index 568c0bbe..e0857003 100644
--- a/client/components/swimlanes/swimlanes.js
+++ b/client/components/swimlanes/swimlanes.js
@@ -246,6 +246,24 @@ BlazeComponent.extendComponent({
currentCardIsInThisList(listId, swimlaneId) {
return currentCardIsInThisList(listId, swimlaneId);
},
+ visible(list) {
+ if (list.archived) {
+ // Show archived list only when filter archive is on or archive is selected
+ if (!(Filter.archive.isSelected() || archivedRequested)) {
+ return false;
+ }
+ }
+ if (Filter.hideEmpty.isSelected()) {
+ const swimlaneId = this.parentComponent()
+ .parentComponent()
+ .data()._id;
+ const cards = list.cards(swimlaneId);
+ if (cards.count() === 0) {
+ return false;
+ }
+ }
+ return true;
+ },
onRendered() {
const boardComponent = this.parentComponent();
const $listsDom = this.$('.js-lists');
diff --git a/client/lib/filter.js b/client/lib/filter.js
index f19dc617..1ca3a280 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -451,10 +451,12 @@ Filter = {
// before changing the schema.
labelIds: new SetFilter(),
members: new SetFilter(),
+ archive: new SetFilter(),
+ hideEmpty: new SetFilter(),
customFields: new SetFilter('_id'),
advanced: new AdvancedFilter(),
- _fields: ['labelIds', 'members', 'customFields'],
+ _fields: ['labelIds', 'members', 'archive', 'hideEmpty', 'customFields'],
// We don't filter cards that have been added after the last filter change. To
// implement this we keep the id of these cards in this `_exceptions` fields