diff --git a/client/components/main/dueCards.jade b/client/components/main/dueCards.jade index b806bce10..7ce14291a 100644 --- a/client/components/main/dueCards.jade +++ b/client/components/main/dueCards.jade @@ -30,21 +30,21 @@ template(name="dueCards") ul.due-cards-context-list li.due-cards-context(title="{{_ 'board'}}") +viewer - = card.board.title + = card.getBoard.title li.due-cards-context.due-cards-context-separator = ' ' | {{_ 'context-separator'}} = ' ' li.due-cards-context(title="{{_ 'swimlane'}}") +viewer - = card.swimlane.title + = card.getSwimlane.title li.due-cards-context = ' ' | {{_ 'context-separator'}} = ' ' li.due-cards-context(title="{{_ 'list'}}") +viewer - = card.list.title + = card.getList.title template(name="dueCardsViewChangePopup") diff --git a/client/components/main/dueCards.js b/client/components/main/dueCards.js index 2e3b3ae9f..aa88cf2e3 100644 --- a/client/components/main/dueCards.js +++ b/client/components/main/dueCards.js @@ -142,22 +142,4 @@ BlazeComponent.extendComponent({ // console.log('cards:', cards); return cards; }, - - events() { - return [ - { - // 'click .js-my-card'(evt) { - // const card = this.currentData().card; - // // eslint-disable-next-line no-console - // console.log('currentData():', this.currentData()); - // // eslint-disable-next-line no-console - // console.log('card:', card); - // if (card) { - // Utils.goCardId(card._id); - // } - // evt.preventDefault(); - // }, - }, - ]; - }, }).register('dueCards'); diff --git a/client/components/main/myCards.jade b/client/components/main/myCards.jade index e16fb8e98..5b063641a 100644 --- a/client/components/main/myCards.jade +++ b/client/components/main/myCards.jade @@ -50,21 +50,21 @@ template(name="myCards") ul.my-cards-context-list li.my-cards-context(title="{{_ 'board'}}") +viewer - = card.board.title + = card.getBoard.title li.my-cards-context.my-cards-context-separator = ' ' | {{_ 'context-separator'}} = ' ' li.my-cards-context(title="{{_ 'swimlane'}}") +viewer - = card.swimlane.title + = card.getSwimlane.title li.my-cards-context = ' ' | {{_ 'context-separator'}} = ' ' li.my-cards-context(title="{{_ 'list'}}") +viewer - = card.list.title + = card.getList.title template(name="myCardsSortChangePopup") diff --git a/client/components/main/myCards.js b/client/components/main/myCards.js index 6cdb173b1..02fa2a025 100644 --- a/client/components/main/myCards.js +++ b/client/components/main/myCards.js @@ -93,7 +93,7 @@ BlazeComponent.extendComponent({ if (list === null || card.listId !== list._id) { // eslint-disable-next-line no-console // console.log('new list'); - list = card.list(); + list = card.getList(); if (list.archived) { list = null; return; @@ -104,7 +104,7 @@ BlazeComponent.extendComponent({ if (swimlane === null || card.swimlaneId !== swimlane._id) { // eslint-disable-next-line no-console // console.log('new swimlane'); - swimlane = card.swimlane(); + swimlane = card.getSwimlane(); if (swimlane.archived) { swimlane = null; return; @@ -115,7 +115,7 @@ BlazeComponent.extendComponent({ if (board === null || card.boardId !== board._id) { // eslint-disable-next-line no-console // console.log('new board'); - board = card.board(); + board = card.getBoard(); if (board.archived) { board = null; return; @@ -201,9 +201,9 @@ BlazeComponent.extendComponent({ const cards = []; cursor.forEach(card => { if ( - !card.board().archived && - !card.swimlane().archived && - !card.list().archived + !card.getBoard().archived && + !card.getSwimlane().archived && + !card.getList().archived ) { cards.push(card); } diff --git a/models/cards.js b/models/cards.js index d8d1513dd..92e80931a 100644 --- a/models/cards.js +++ b/models/cards.js @@ -469,6 +469,45 @@ Cards.helpers({ return Boards.findOne(this.boardId); }, + getList() { + const list = this.list(); + if (!list) { + return { + _id: this.listId, + title: 'Undefined List', + archived: false, + colorClass: '', + }; + } + return list; + }, + + getSwimlane() { + const swimlane = this.swimlane(); + if (!swimlane) { + return { + _id: this.swimlaneId, + title: 'Undefined Swimlane', + archived: false, + colorClass: '', + }; + } + return swimlane; + }, + + getBoard() { + const board = this.board(); + if (!board) { + return { + _id: this.boardId, + title: 'Undefined Board', + archived: false, + colorClass: '', + }; + } + return board; + }, + labels() { const boardLabels = this.board().labels; const cardLabels = _.filter(boardLabels, label => { diff --git a/server/publications/cards.js b/server/publications/cards.js index 02b64715a..7729adb3c 100644 --- a/server/publications/cards.js +++ b/server/publications/cards.js @@ -104,9 +104,9 @@ Meteor.publish('dueCards', function(allUsers = false) { const lists = []; cards.forEach(card => { - boards.push(card.boardId); - swimlanes.push(card.swimlaneId); - lists.push(card.listId); + if (card.boardId) boards.push(card.boardId); + if (card.swimlaneId) swimlanes.push(card.swimlaneId); + if (card.listId) lists.push(card.listId); }); return [