diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-06-21 11:53:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 11:53:20 +0300 |
commit | 3d3c78260b3bb856f2520316a787913644dc48f2 (patch) | |
tree | 499a9308277668b75ac2443883f4edf221583e10 /client/components/rules | |
parent | 02de9164f014e149d3536a7c3cae88beda358318 (diff) | |
parent | a9fc74a9b4b711813d5219ed7ffda8cd20f45fb6 (diff) | |
download | wekan-3d3c78260b3bb856f2520316a787913644dc48f2.tar.gz wekan-3d3c78260b3bb856f2520316a787913644dc48f2.tar.bz2 wekan-3d3c78260b3bb856f2520316a787913644dc48f2.zip |
Merge pull request #2506 from road42/feature/rule_card_action_setdate
Adds rule feature: cardAction - SetDate #2504
Diffstat (limited to 'client/components/rules')
-rw-r--r-- | client/components/rules/actions/cardActions.jade | 41 | ||||
-rw-r--r-- | client/components/rules/actions/cardActions.js | 48 |
2 files changed, 85 insertions, 4 deletions
diff --git a/client/components/rules/actions/cardActions.jade b/client/components/rules/actions/cardActions.jade index 8c6defc6..c10c4b2b 100644 --- a/client/components/rules/actions/cardActions.jade +++ b/client/components/rules/actions/cardActions.jade @@ -2,10 +2,43 @@ template(name="cardActions") div.trigger-item div.trigger-content div.trigger-dropdown + select(id="setdate-action") + option(value="setDate") {{{_'r-set'}}} + option(value="updateDate") {{{_'r-update'}}} + div.trigger-text + | {{{_'r-datefield'}}} + div.trigger-dropdown + select(id="setdate-datefield") + option(value="startAt") {{{_'r-df-start-at'}}} + option(value="dueAt") {{{_'r-df-due-at'}}} + option(value="endAt") {{{_'r-df-end-at'}}} + option(value="receivedAt") {{{_'r-df-received-at'}}} + div.trigger-text + | {{{_'r-to-current-datetime'}}} + div.trigger-button.js-set-date-action.js-goto-rules + i.fa.fa-plus + + div.trigger-item + div.trigger-content + div.trigger-text + | {{{_'r-remove-value-from'}}} + | {{{_'r-datefield'}}} + div.trigger-dropdown + select(id="setdate-removedatefieldvalue") + option(value="startAt") {{{_'r-df-start-at'}}} + option(value="dueAt") {{{_'r-df-due-at'}}} + option(value="endAt") {{{_'r-df-end-at'}}} + option(value="receivedAt") {{{_'r-df-received-at'}}} + div.trigger-button.js-remove-datevalue-action.js-goto-rules + i.fa.fa-plus + + div.trigger-item + div.trigger-content + div.trigger-dropdown select(id="label-action") option(value="add") {{{_'r-add'}}} option(value="remove") {{{_'r-remove'}}} - div.trigger-text + div.trigger-text | {{{_'r-label'}}} div.trigger-dropdown select(id="label-id") @@ -21,16 +54,16 @@ template(name="cardActions") select(id="member-action") option(value="add") {{{_'r-add'}}} option(value="remove") {{{_'r-remove'}}} - div.trigger-text + div.trigger-text | {{{_'r-member'}}} div.trigger-dropdown - input(id="member-name",type=text,placeholder="{{{_'r-name'}}}") + input(id="member-name",type=text,placeholder="{{{_'r-name'}}}") div.trigger-button.js-add-member-action.js-goto-rules i.fa.fa-plus div.trigger-item div.trigger-content - div.trigger-text + div.trigger-text | {{{_'r-remove-all'}}} div.trigger-button.js-add-removeall-action.js-goto-rules i.fa.fa-plus 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(); |