diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2019-02-23 15:32:44 +0100 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2019-02-24 00:05:00 +0100 |
commit | 7a6afb8aea2c3398ec0fe34d664398bd94cac90a (patch) | |
tree | 7aa6f53617370333973800605c85ed1fcf6f621e /client/components/lists/listBody.js | |
parent | 1e72177991e3fe11a1837e3e294e4de5d728aa30 (diff) | |
download | wekan-7a6afb8aea2c3398ec0fe34d664398bd94cac90a.tar.gz wekan-7a6afb8aea2c3398ec0fe34d664398bd94cac90a.tar.bz2 wekan-7a6afb8aea2c3398ec0fe34d664398bd94cac90a.zip |
Add template search in Add Card menu
Archive all cards in list when list is archived
Remove default board in link popup
Only list non-template boards in card link and search
Diffstat (limited to 'client/components/lists/listBody.js')
-rw-r--r-- | client/components/lists/listBody.js | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index eccef552..66d056c4 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -316,6 +316,7 @@ BlazeComponent.extendComponent({ keydown: this.pressKey, 'click .js-link': Popup.open('linkCard'), 'click .js-search': Popup.open('searchCard'), + 'click .js-search-template': Popup.open('searchCard'), }]; }, @@ -390,17 +391,7 @@ BlazeComponent.extendComponent({ BlazeComponent.extendComponent({ onCreated() { - // Prefetch first non-current board id - const boardId = Boards.findOne({ - archived: false, - 'members.userId': Meteor.userId(), - _id: {$ne: Session.get('currentBoard')}, - }, { - sort: ['title'], - })._id; - // Subscribe to this board - subManager.subscribe('board', boardId); - this.selectedBoardId = new ReactiveVar(boardId); + this.selectedBoardId = new ReactiveVar(''); this.selectedSwimlaneId = new ReactiveVar(''); this.selectedListId = new ReactiveVar(''); @@ -426,6 +417,7 @@ BlazeComponent.extendComponent({ archived: false, 'members.userId': Meteor.userId(), _id: {$ne: Session.get('currentBoard')}, + type: 'board', }, { sort: ['title'], }); @@ -433,7 +425,7 @@ BlazeComponent.extendComponent({ }, swimlanes() { - if (!this.selectedBoardId) { + if (!this.selectedBoardId.get()) { return []; } const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()}); @@ -443,7 +435,7 @@ BlazeComponent.extendComponent({ }, lists() { - if (!this.selectedBoardId) { + if (!this.selectedBoardId.get()) { return []; } const lists = Lists.find({boardId: this.selectedBoardId.get()}); @@ -531,12 +523,18 @@ BlazeComponent.extendComponent({ }, onCreated() { - // Prefetch first non-current board id - let board = Boards.findOne({ - archived: false, - 'members.userId': Meteor.userId(), - _id: {$ne: Session.get('currentBoard')}, - }); + const isTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-search-template'); + let board = {}; + if (isTemplateSearch) { + board = Boards.findOne(Meteor.user().profile.templatesBoardId); + } else { + // Prefetch first non-current board id + board = Boards.findOne({ + archived: false, + 'members.userId': Meteor.userId(), + _id: {$ne: Session.get('currentBoard')}, + }); + } if (!board) { Popup.close(); return; @@ -568,6 +566,7 @@ BlazeComponent.extendComponent({ archived: false, 'members.userId': Meteor.userId(), _id: {$ne: Session.get('currentBoard')}, + type: 'board', }, { sort: ['title'], }); @@ -610,3 +609,9 @@ BlazeComponent.extendComponent({ }]; }, }).register('searchCardPopup'); + +Template.searchCardPopup.helpers({ + isTemplateSearch() { + return $(Popup._getTopStack().openerElement).hasClass('js-search-template'); + }, +}); |