From 0a53ee87b94232608b5131f47dd77d2fa4bbc5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Fri, 22 Feb 2019 22:59:19 +0100 Subject: Add first draft of data model and user interface. No actions. --- models/cards.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index ff19a9a0..e9fc453e 100644 --- a/models/cards.js +++ b/models/cards.js @@ -246,7 +246,7 @@ Cards.attachSchema(new SimpleSchema({ * type of the card */ type: String, - defaultValue: '', + defaultValue: 'cardType-card', }, linkedId: { /** @@ -930,6 +930,10 @@ Cards.helpers({ return this.assignedBy; } }, + + isTemplateCard() { + return this.type === 'template-card'; + }, }); Cards.mutations({ -- cgit v1.2.3-1-g7c22 From 0fec7115451ba3b49442965c8160df4911157601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Sat, 23 Feb 2019 16:36:29 +0100 Subject: Prepare to create card from template --- models/cards.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index e9fc453e..c7b4a366 100644 --- a/models/cards.js +++ b/models/cards.js @@ -272,6 +272,31 @@ Cards.allow({ }); Cards.helpers({ + copy() { + const oldId = this._id; + this._id = null; + const _id = Cards.insert(this); + + // copy checklists + Checklists.find({cardId: oldId}).forEach((ch) => { + ch.copy(_id); + }); + + // copy subtasks + Cards.find({parentId: oldId}).forEach((subtask) => { + subtask.parentId = _id; + subtask._id = null; + Cards.insert(subtask); + }); + + // copy card comments + CardComments.find({cardId: oldId}).forEach((cmt) => { + cmt.copy(_id); + }); + + return _id; + }, + list() { return Lists.findOne(this.listId); }, -- cgit v1.2.3-1-g7c22 From eb62c9ce6ad0fa0d5de7889ec087db8cdc579339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Sun, 24 Feb 2019 00:13:35 +0100 Subject: Fix lint errors --- models/cards.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index c7b4a366..e91f0af5 100644 --- a/models/cards.js +++ b/models/cards.js @@ -273,28 +273,28 @@ Cards.allow({ Cards.helpers({ copy() { - const oldId = this._id; - this._id = null; - const _id = Cards.insert(this); + const oldId = this._id; + this._id = null; + const _id = Cards.insert(this); - // copy checklists - Checklists.find({cardId: oldId}).forEach((ch) => { - ch.copy(_id); - }); + // copy checklists + Checklists.find({cardId: oldId}).forEach((ch) => { + ch.copy(_id); + }); - // copy subtasks - Cards.find({parentId: oldId}).forEach((subtask) => { - subtask.parentId = _id; - subtask._id = null; - Cards.insert(subtask); - }); + // copy subtasks + Cards.find({parentId: oldId}).forEach((subtask) => { + subtask.parentId = _id; + subtask._id = null; + Cards.insert(subtask); + }); - // copy card comments - CardComments.find({cardId: oldId}).forEach((cmt) => { - cmt.copy(_id); - }); + // copy card comments + CardComments.find({cardId: oldId}).forEach((cmt) => { + cmt.copy(_id); + }); - return _id; + return _id; }, list() { @@ -1259,7 +1259,7 @@ Cards.mutations({ function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) { if ((_.contains(fieldNames, 'listId') && doc.listId !== oldListId) || - (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){ + (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){ Activities.insert({ userId, oldListId, -- cgit v1.2.3-1-g7c22 From dc7286a0ef8111c0855129911492588ba8a384df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Mon, 25 Feb 2019 22:48:25 +0100 Subject: Fix list view issues. Allow creation of boards from templates --- models/cards.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index e91f0af5..c733c7f8 100644 --- a/models/cards.js +++ b/models/cards.js @@ -274,7 +274,7 @@ Cards.allow({ Cards.helpers({ copy() { const oldId = this._id; - this._id = null; + delete this._id; const _id = Cards.insert(this); // copy checklists -- cgit v1.2.3-1-g7c22