Completed rules

This commit is contained in:
Angelo Gallarello 2018-08-19 18:53:50 +02:00
parent 3b62b5ec5d
commit 1f5f429fc4
21 changed files with 551 additions and 157 deletions

View file

@ -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);