summaryrefslogtreecommitdiffstats
path: root/models/lists.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-23 20:41:36 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commitf888cfd565b197903c24a07221f6a6a44e1b6223 (patch)
tree7745b9c3913ae62f2bc08fb0a1049ec9754f2d4d /models/lists.js
parent044126188d28a24b0df5d67cf69d081ce7790886 (diff)
downloadwekan-f888cfd565b197903c24a07221f6a6a44e1b6223.tar.gz
wekan-f888cfd565b197903c24a07221f6a6a44e1b6223.tar.bz2
wekan-f888cfd565b197903c24a07221f6a6a44e1b6223.zip
Allow list creation from template
Diffstat (limited to 'models/lists.js')
-rw-r--r--models/lists.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/models/lists.js b/models/lists.js
index 236432cc..e2ded36e 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -137,6 +137,24 @@ Lists.allow({
});
Lists.helpers({
+ copy() {
+ const oldId = this._id;
+ this._id = null;
+ const _id = Lists.insert(this);
+
+ // Copy all cards in list
+ Cards.find({
+ listId: oldId,
+ archived: false,
+ }).forEach((card) => {
+ card.type = 'cardType-card';
+ card.listId = _id;
+ card.boardId = this.boardId;
+ card.swimlaneId = this.swimlaneId;
+ card.copy();
+ });
+ },
+
cards(swimlaneId) {
const selector = {
listId: this._id,