diff options
Diffstat (limited to 'models/cards.js')
-rw-r--r-- | models/cards.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/models/cards.js b/models/cards.js index af8bea48..4b18b8f3 100644 --- a/models/cards.js +++ b/models/cards.js @@ -393,6 +393,39 @@ Cards.helpers({ isTopLevel() { return this.parentId === ''; }, + + isImportedCard() { + return this.type === 'cardType-importedCard'; + }, + + isImportedBoard() { + return this.type === 'cardType-importedBoard'; + }, + + isImported() { + return this.isImportedCard() || this.isImportedBoard(); + }, + + getDescription() { + if (this.isImportedCard()) { + const card = Cards.findOne({_id: this.importedId}); + if (card && card.description) + return card.description; + else + return null; + } else if (this.isImportedBoard()) { + const board = Boards.findOne({_id: this.importedId}); + if (board && board.description) + return board.description; + else + return null; + } else { + if (this.description) + return this.description; + else + return null; + } + }, }); Cards.mutations({ |