mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Helpers for dealing with trees of cards
This commit is contained in:
parent
879a84184f
commit
fd465fbb60
2 changed files with 19 additions and 1 deletions
|
|
@ -297,14 +297,33 @@ Cards.helpers({
|
|||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
parentCard() {
|
||||
if (this.parentId === '') {
|
||||
return null;
|
||||
}
|
||||
return Cards.findOne(this.parentId);
|
||||
},
|
||||
|
||||
isTopLevel() {
|
||||
return this.parentId === '';
|
||||
},
|
||||
});
|
||||
|
||||
Cards.mutations({
|
||||
applyToKids(funct) {
|
||||
Cards.find({ parentId: this._id }).forEach((card) => {
|
||||
funct(card);
|
||||
});
|
||||
},
|
||||
|
||||
archive() {
|
||||
this.applyToKids((card) => { return card.archive(); });
|
||||
return {$set: {archived: true}};
|
||||
},
|
||||
|
||||
restore() {
|
||||
this.applyToKids((card) => { return card.restore(); });
|
||||
return {$set: {archived: false}};
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -258,7 +258,6 @@ Migrations.add('add-assigner-field', () => {
|
|||
}, noValidateMulti);
|
||||
});
|
||||
|
||||
|
||||
Migrations.add('add-parent-field-to-cards', () => {
|
||||
Cards.update({
|
||||
parentId: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue