summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAngelo Gallarello <angelo.gallarell@gmail.com>2018-08-19 18:53:50 +0200
committerAngelo Gallarello <angelo.gallarell@gmail.com>2018-08-19 18:53:50 +0200
commit1f5f429fc4535d251d32335eea7e44904a924650 (patch)
treee9f9b439227392ff5c8373594864890dbe4b1da7 /models
parent3b62b5ec5dd34eec323c14d466fe07e34287e7b0 (diff)
downloadwekan-1f5f429fc4535d251d32335eea7e44904a924650.tar.gz
wekan-1f5f429fc4535d251d32335eea7e44904a924650.tar.bz2
wekan-1f5f429fc4535d251d32335eea7e44904a924650.zip
Completed rules
Diffstat (limited to 'models')
-rw-r--r--models/actions.js4
-rw-r--r--models/checklistItems.js6
-rw-r--r--models/checklists.js12
3 files changed, 22 insertions, 0 deletions
diff --git a/models/actions.js b/models/actions.js
index 93d45928..daa5cc96 100644
--- a/models/actions.js
+++ b/models/actions.js
@@ -16,6 +16,10 @@ Actions.allow({
insert: function () {
// add custom authentication code here
return true;
+ },
+ remove: function () {
+ // add custom authentication code here
+ return true;
}
});
diff --git a/models/checklistItems.js b/models/checklistItems.js
index 669003bb..e24f0cbd 100644
--- a/models/checklistItems.js
+++ b/models/checklistItems.js
@@ -44,6 +44,12 @@ ChecklistItems.mutations({
setTitle(title) {
return { $set: { title } };
},
+ check(){
+ return { $set: { isFinished: true } };
+ },
+ uncheck(){
+ return { $set: { isFinished: false } };
+ },
toggleItem() {
return { $set: { isFinished: !this.isFinished } };
},
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);