mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Prepare to create card from template
This commit is contained in:
parent
7a6afb8aea
commit
0fec711545
7 changed files with 57 additions and 60 deletions
|
@ -48,6 +48,19 @@ Checklists.attachSchema(new SimpleSchema({
|
|||
}));
|
||||
|
||||
Checklists.helpers({
|
||||
copy(newCardId) {
|
||||
const oldChecklistId = this._id;
|
||||
this._id = null;
|
||||
this.cardId = newCardId;
|
||||
const newChecklistId = Checklists.insert(this);
|
||||
ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => {
|
||||
item._id = null;
|
||||
item.checklistId = newChecklistId;
|
||||
item.cardId = newCardId;
|
||||
ChecklistItems.insert(item);
|
||||
});
|
||||
},
|
||||
|
||||
itemCount() {
|
||||
return ChecklistItems.find({ checklistId: this._id }).count();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue