Merge branch 'PDIS-master'

This commit is contained in:
Lauri Ojansivu 2019-08-16 22:36:19 +03:00
commit 564ab219c6
8 changed files with 63 additions and 6 deletions

View file

@ -1,3 +1,4 @@
archivedRequested = false;
const subManager = new SubsManager(); const subManager = new SubsManager();
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({
@ -12,6 +13,7 @@ BlazeComponent.extendComponent({
const currentBoardId = Session.get('currentBoard'); const currentBoardId = Session.get('currentBoard');
if (!currentBoardId) return; if (!currentBoardId) return;
const handle = subManager.subscribe('board', currentBoardId, true); const handle = subManager.subscribe('board', currentBoardId, true);
archivedRequested = true;
Tracker.nonreactive(() => { Tracker.nonreactive(() => {
Tracker.autorun(() => { Tracker.autorun(() => {
this.isArchiveReady.set(handle.ready()); this.isArchiveReady.set(handle.ready());

View file

@ -56,6 +56,22 @@ template(name="filterSidebar")
if Filter.customFields.isSelected _id if Filter.customFields.isSelected _id
i.fa.fa-check i.fa.fa-check
hr 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'}} span {{_ 'advanced-filter-label'}}
input.js-field-advanced-filter(type="text") input.js-field-advanced-filter(type="text")
span {{_ 'advanced-filter-description'}} span {{_ 'advanced-filter-description'}}

View file

@ -1,3 +1,5 @@
const subManager = new SubsManager();
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({
events() { events() {
return [ return [
@ -12,6 +14,23 @@ BlazeComponent.extendComponent({
Filter.members.toggle(this.currentData()._id); Filter.members.toggle(this.currentData()._id);
Filter.resetExceptions(); 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) { 'click .js-toggle-custom-fields-filter'(evt) {
evt.preventDefault(); evt.preventDefault();
Filter.customFields.toggle(this.currentData()._id); Filter.customFields.toggle(this.currentData()._id);

View file

@ -33,7 +33,8 @@ template(name="listsGroup")
+addListForm +addListForm
else else
each lists each lists
+list(this) if visible this
+list(this)
if currentCardIsInThisList _id null if currentCardIsInThisList _id null
+cardDetails(currentCard) +cardDetails(currentCard)
if currentUser.isBoardMember if currentUser.isBoardMember

View file

@ -246,6 +246,24 @@ BlazeComponent.extendComponent({
currentCardIsInThisList(listId, swimlaneId) { currentCardIsInThisList(listId, swimlaneId) {
return 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() { onRendered() {
const boardComponent = this.parentComponent(); const boardComponent = this.parentComponent();
const $listsDom = this.$('.js-lists'); const $listsDom = this.$('.js-lists');

View file

@ -451,10 +451,12 @@ Filter = {
// before changing the schema. // before changing the schema.
labelIds: new SetFilter(), labelIds: new SetFilter(),
members: new SetFilter(), members: new SetFilter(),
archive: new SetFilter(),
hideEmpty: new SetFilter(),
customFields: new SetFilter('_id'), customFields: new SetFilter('_id'),
advanced: new AdvancedFilter(), 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 // 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 // implement this we keep the id of these cards in this `_exceptions` fields

View file

@ -306,6 +306,8 @@
"filter-no-label": "No label", "filter-no-label": "No label",
"filter-no-member": "No member", "filter-no-member": "No member",
"filter-no-custom-fields": "No Custom Fields", "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": "Filter is on",
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.", "filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
"filter-to-selection": "Filter to selection", "filter-to-selection": "Filter to selection",

View file

@ -407,10 +407,7 @@ Boards.helpers({
}, },
lists() { lists() {
return Lists.find( return Lists.find({ boardId: this._id }, { sort: { sort: 1 } });
{ boardId: this._id, archived: false },
{ sort: { sort: 1 } },
);
}, },
nullSortLists() { nullSortLists() {