mirror of
https://github.com/wekan/wekan.git
synced 2026-01-06 01:28:49 +01:00
Add 'show archive' and 'hide empty lists' in filter feature.
This commit is contained in:
parent
cf9ad221f8
commit
4f4e0a21f8
9 changed files with 1514 additions and 1450 deletions
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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'}}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ template(name="listsGroup")
|
|||
+addListForm
|
||||
else
|
||||
each lists
|
||||
if visible this
|
||||
+list(this)
|
||||
if currentCardIsInThisList _id null
|
||||
+cardDetails(currentCard)
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -304,6 +304,8 @@
|
|||
"filter-no-label": "No label",
|
||||
"filter-no-member": "No member",
|
||||
"filter-no-custom-fields": "No Custom Fields",
|
||||
"filter-show-archive": "Show archived lists",
|
||||
"filter-hide-empty": "Hide empty lists",
|
||||
"filter-on": "Filter is on",
|
||||
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
|
||||
"filter-to-selection": "Filter to selection",
|
||||
|
|
|
|||
|
|
@ -303,7 +303,9 @@
|
|||
"filter-clear": "フィルターの解除",
|
||||
"filter-no-label": "ラベルなし",
|
||||
"filter-no-member": "メンバーなし",
|
||||
"filter-no-custom-fields": "No Custom Fields",
|
||||
"filter-no-custom-fields": "カスタムフィールドなし",
|
||||
"filter-show-archive": "アーカイブされたリストを表示",
|
||||
"filter-hide-empty": "空のリストを隠す",
|
||||
"filter-on": "フィルター有効",
|
||||
"filter-on-desc": "このボードのカードをフィルターしています。フィルターを編集するにはこちらをクリックしてください。",
|
||||
"filter-to-selection": "フィルターした項目を全選択",
|
||||
|
|
|
|||
|
|
@ -304,6 +304,8 @@
|
|||
"filter-no-label": "沒有標籤",
|
||||
"filter-no-member": "沒有成員",
|
||||
"filter-no-custom-fields": "沒有自訂欄位",
|
||||
"filter-show-archive": "顯示已封存清單",
|
||||
"filter-hide-empty": "隱藏空白清單",
|
||||
"filter-on": "篩選器已開啟",
|
||||
"filter-on-desc": "你正在篩選該看板上的卡片,點此編輯篩選條件。",
|
||||
"filter-to-selection": "選擇的篩選條件",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue