diff options
Diffstat (limited to 'models/checklists.js')
-rw-r--r-- | models/checklists.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/checklists.js b/models/checklists.js index 4a43818c..26429092 100644 --- a/models/checklists.js +++ b/models/checklists.js @@ -47,6 +47,18 @@ Checklists.helpers({ isFinished() { return 0 !== this.itemCount() && this.itemCount() === this.finishedCount(); }, + checkAllItems(){ + const checkItems = ChecklistItems.find({checklistId: this._id}); + checkItems.forEach(function(item){ + item.check(); + }); + }, + uncheckAllItems(){ + const checkItems = ChecklistItems.find({checklistId: this._id}); + checkItems.forEach(function(item){ + item.uncheck(); + }); + }, itemIndex(itemId) { const items = self.findOne({_id : this._id}).items; return _.pluck(items, '_id').indexOf(itemId); |