summaryrefslogtreecommitdiffstats
path: root/client/components/rules/actions/checklistActions.js
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 /client/components/rules/actions/checklistActions.js
parent3b62b5ec5dd34eec323c14d466fe07e34287e7b0 (diff)
downloadwekan-1f5f429fc4535d251d32335eea7e44904a924650.tar.gz
wekan-1f5f429fc4535d251d32335eea7e44904a924650.tar.bz2
wekan-1f5f429fc4535d251d32335eea7e44904a924650.zip
Completed rules
Diffstat (limited to 'client/components/rules/actions/checklistActions.js')
-rw-r--r--client/components/rules/actions/checklistActions.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/client/components/rules/actions/checklistActions.js b/client/components/rules/actions/checklistActions.js
new file mode 100644
index 00000000..2a70ca7f
--- /dev/null
+++ b/client/components/rules/actions/checklistActions.js
@@ -0,0 +1,61 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.subscribe('allRules');
+ },
+ events() {
+ return [
+ {'click .js-add-checklist-action'(event) {
+ const ruleName = this.data().ruleName.get();
+ const trigger = this.data().triggerVar.get();
+ const actionSelected = this.find('#check-action').value;
+ const checklistName = this.find('#checklist-name').value;
+
+ if(actionSelected == "add"){
+ const triggerId = Triggers.insert(trigger);
+ const actionId = Actions.insert({actionType: "addChecklist","checklistName":checklistName});
+ Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId});
+ }
+ if(actionSelected == "remove"){
+ const triggerId = Triggers.insert(trigger);
+ const actionId = Actions.insert({actionType: "removeChecklist","checklistName":checklistName});
+ Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId});
+ }
+
+ },
+ 'click .js-add-checkall-action'(event) {
+ const ruleName = this.data().ruleName.get();
+ const trigger = this.data().triggerVar.get();
+ const actionSelected = this.find('#checkall-action').value;
+ const checklistName = this.find('#checklist-name2').value;
+ if(actionSelected == "check"){
+ const triggerId = Triggers.insert(trigger);
+ const actionId = Actions.insert({actionType: "checkAll","checklistName":checklistName});
+ Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId});
+ }
+ if(actionSelected == "uncheck"){
+ const triggerId = Triggers.insert(trigger);
+ const actionId = Actions.insert({actionType: "uncheckAll","checklistName":checklistName});
+ Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId});
+ }
+ },
+ 'click .js-add-check-item-action'(event) {
+ const ruleName = this.data().ruleName.get();
+ const trigger = this.data().triggerVar.get();
+ const checkItemName = this.find("#checkitem-name");
+ const checklistName = this.find("#checklist-name3");
+ const actionSelected = this.find('#check-item-action').value;
+ if(actionSelected == "check"){
+ const triggerId = Triggers.insert(trigger);
+ const actionId = Actions.insert({actionType: "checkItem","checklistName":checklistName,"checkItemName":checkItemName});
+ Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId});
+ }
+ if(actionSelected == "uncheck"){
+ const triggerId = Triggers.insert(trigger);
+ const actionId = Actions.insert({actionType: "uncheckItem","checklistName":checklistName,"checkItemName":checkItemName});
+ Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId});
+ }
+},
+}];
+},
+
+}).register('checklistActions'); \ No newline at end of file