From a9fc74a9b4b711813d5219ed7ffda8cd20f45fb6 Mon Sep 17 00:00:00 2001 From: Christoph Jahn Date: Fri, 21 Jun 2019 07:24:21 +0200 Subject: Adds rule feature: cardAction - SetDate #2504 --- client/components/rules/actions/cardActions.jade | 41 ++++++++++++++++++-- client/components/rules/actions/cardActions.js | 48 ++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 4 deletions(-) (limited to 'client/components/rules') 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 @@ -1,11 +1,44 @@ 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(); -- cgit v1.2.3-1-g7c22