Allow list creation from template

This commit is contained in:
Andrés Manelli 2019-02-23 20:41:36 +01:00
parent 044126188d
commit f888cfd565
8 changed files with 121 additions and 26 deletions

View file

@ -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,