diff options
author | Nicu Tofan <nicu.tofan@gmail.com> | 2018-06-26 17:39:31 +0300 |
---|---|---|
committer | Nicu Tofan <nicu.tofan@gmail.com> | 2018-06-26 17:39:31 +0300 |
commit | b7d508e8c4cf858559e144053d119ceaebfa9697 (patch) | |
tree | d909d73704705e9f78f3039fd3d10dd3dfc685ea /models | |
parent | 439d7c3dbc38e6b8165b3d65f78d0f90e7e5d7db (diff) | |
download | wekan-b7d508e8c4cf858559e144053d119ceaebfa9697.tar.gz wekan-b7d508e8c4cf858559e144053d119ceaebfa9697.tar.bz2 wekan-b7d508e8c4cf858559e144053d119ceaebfa9697.zip |
Added ability to change card's parent.
Diffstat (limited to 'models')
-rw-r--r-- | models/boards.js | 4 | ||||
-rw-r--r-- | models/cards.js | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/models/boards.js b/models/boards.js index 2d80a56a..c83050c0 100644 --- a/models/boards.js +++ b/models/boards.js @@ -220,6 +220,10 @@ Boards.helpers({ return Swimlanes.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } }); }, + cards() { + return Cards.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } }); + }, + hasOvertimeCards(){ const card = Cards.findOne({isOvertime: true, boardId: this._id, archived: false} ); return card !== undefined; diff --git a/models/cards.js b/models/cards.js index 323ec407..b6a7b4c6 100644 --- a/models/cards.js +++ b/models/cards.js @@ -327,10 +327,14 @@ Cards.helpers({ }, parentCardName() { - if (this.parentId === '') { - return ''; + let result = ''; + if (this.parentId !== '') { + const card = Cards.findOne(this.parentId); + if (card) { + result = card.title; + } } - return Cards.findOne(this.parentId).title; + return result; }, parentListId() { @@ -541,6 +545,11 @@ Cards.mutations({ unsetSpentTime() { return {$unset: {spentTime: '', isOvertime: false}}; }, + + setParentId(parentId) { + return {$set: {parentId}}; + }, + }); |