summaryrefslogtreecommitdiffstats
path: root/client/components/rules/actions/cardActions.js
diff options
context:
space:
mode:
authorChristoph Jahn <cj@road42.de>2019-06-21 07:24:21 +0200
committerChristoph Jahn <cj@road42.de>2019-06-21 07:24:21 +0200
commita9fc74a9b4b711813d5219ed7ffda8cd20f45fb6 (patch)
tree499a9308277668b75ac2443883f4edf221583e10 /client/components/rules/actions/cardActions.js
parent02de9164f014e149d3536a7c3cae88beda358318 (diff)
downloadwekan-a9fc74a9b4b711813d5219ed7ffda8cd20f45fb6.tar.gz
wekan-a9fc74a9b4b711813d5219ed7ffda8cd20f45fb6.tar.bz2
wekan-a9fc74a9b4b711813d5219ed7ffda8cd20f45fb6.zip
Adds rule feature: cardAction - SetDate #2504
Diffstat (limited to 'client/components/rules/actions/cardActions.js')
-rw-r--r--client/components/rules/actions/cardActions.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/client/components/rules/actions/cardActions.js b/client/components/rules/actions/cardActions.js
index a1e43c38..d6e11eea 100644
--- a/client/components/rules/actions/cardActions.js
+++ b/client/components/rules/actions/cardActions.js
@@ -29,6 +29,54 @@ BlazeComponent.extendComponent({
events() {
return [{
+ 'click .js-set-date-action' (event) {
+ const ruleName = this.data().ruleName.get();
+ const trigger = this.data().triggerVar.get();
+ const triggerId = Triggers.insert(trigger);
+ const actionSelected = this.find('#setdate-action').value;
+ const dateFieldSelected = this.find('#setdate-datefield').value;
+ const boardId = Session.get('currentBoard');
+ const desc = Utils.getTriggerActionDesc(event, this);
+
+ const actionId = Actions.insert({
+ actionType: actionSelected,
+ dateField: dateFieldSelected,
+ boardId,
+ desc,
+ });
+
+ Rules.insert({
+ title: ruleName,
+ triggerId,
+ actionId,
+ boardId,
+ desc,
+ });
+ },
+
+ 'click .js-remove-datevalue-action' (event) {
+ const ruleName = this.data().ruleName.get();
+ const trigger = this.data().triggerVar.get();
+ const triggerId = Triggers.insert(trigger);
+ const dateFieldSelected = this.find('#setdate-removedatefieldvalue').value;
+ const boardId = Session.get('currentBoard');
+ const desc = Utils.getTriggerActionDesc(event, this);
+
+ const actionId = Actions.insert({
+ actionType: 'removeDate',
+ dateField: dateFieldSelected,
+ boardId,
+ desc,
+ });
+
+ Rules.insert({
+ title: ruleName,
+ triggerId,
+ actionId,
+ boardId,
+ desc,
+ });
+ },
'click .js-add-label-action' (event) {
const ruleName = this.data().ruleName.get();
const trigger = this.data().triggerVar.get();