From 3e715bbcc9e2cf3aad043dc7ab0ed76b519e80eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Tue, 21 Aug 2018 22:20:45 +0200 Subject: Fix and improve linked cards --- client/components/lists/listBody.jade | 2 +- client/components/lists/listBody.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade index 8069717e..f2b3e941 100644 --- a/client/components/lists/listBody.jade +++ b/client/components/lists/listBody.jade @@ -70,7 +70,7 @@ template(name="linkCardPopup") label {{_ 'cards'}}: select.js-select-cards each cards - option(value="{{_id}}") {{title}} + option(value="{{getId}}") {{getTitle}} .edit-controls.clearfix input.primary.confirm.js-done(type="button" value="{{_ 'link'}}") diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 83592a64..896bf178 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -333,21 +333,22 @@ BlazeComponent.extendComponent({ }, cards() { + const ownCardsIds = this.board.cards().map((card) => { return card.linkedId || card._id; }); return Cards.find({ boardId: this.selectedBoardId.get(), swimlaneId: this.selectedSwimlaneId.get(), listId: this.selectedListId.get(), archived: false, - linkedId: null, - _id: {$nin: this.board.cards().map((card) => { return card.linkedId || card._id; })}, + linkedId: {$nin: ownCardsIds}, + _id: {$nin: ownCardsIds}, }); }, events() { return [{ 'change .js-select-boards'(evt) { + subManager.subscribe('board', $(evt.currentTarget).val()); this.selectedBoardId.set($(evt.currentTarget).val()); - subManager.subscribe('board', this.selectedBoardId.get()); }, 'change .js-select-swimlanes'(evt) { this.selectedSwimlaneId.set($(evt.currentTarget).val()); @@ -438,14 +439,14 @@ BlazeComponent.extendComponent({ results() { const board = Boards.findOne(this.selectedBoardId.get()); - return board.searchCards(this.term.get(), true); + return board.searchCards(this.term.get(), false); }, events() { return [{ 'change .js-select-boards'(evt) { + subManager.subscribe('board', $(evt.currentTarget).val()); this.selectedBoardId.set($(evt.currentTarget).val()); - subManager.subscribe('board', this.selectedBoardId.get()); }, 'submit .js-search-term-form'(evt) { evt.preventDefault(); @@ -461,7 +462,7 @@ BlazeComponent.extendComponent({ boardId: this.boardId, sort: Lists.findOne(this.listId).cards().count(), type: 'cardType-linkedCard', - linkedId: card._id, + linkedId: card.linkedId || card._id, }); Filter.addException(_id); Popup.close(); -- cgit v1.2.3-1-g7c22