From 3eb4d2c341b712268bd321173909e0a7b19a88c9 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Fri, 28 Jun 2019 12:52:09 -0500 Subject: Prettier & eslint project style update --- client/components/rules/actions/boardActions.js | 275 ++++++++++---------- client/components/rules/actions/cardActions.js | 285 +++++++++++---------- .../components/rules/actions/checklistActions.js | 261 ++++++++++--------- client/components/rules/actions/mailActions.js | 57 ++--- 4 files changed, 438 insertions(+), 440 deletions(-) (limited to 'client/components/rules/actions') diff --git a/client/components/rules/actions/boardActions.js b/client/components/rules/actions/boardActions.js index e0b8edc9..8568d2bf 100644 --- a/client/components/rules/actions/boardActions.js +++ b/client/components/rules/actions/boardActions.js @@ -1,68 +1,23 @@ BlazeComponent.extendComponent({ - onCreated() { - - }, + onCreated() {}, events() { - return [{ - 'click .js-create-card-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const cardName = this.find('#card-name').value; - const listName = this.find('#list-name').value; - const swimlaneName = this.find('#swimlane-name2').value; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'createCard', - swimlaneName, - cardName, - listName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - - }, - 'click .js-add-swimlane-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const swimlaneName = this.find('#swimlane-name').value; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'addSwimlane', - swimlaneName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - - }, - 'click .js-add-spec-move-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const actionSelected = this.find('#move-spec-action').value; - const listTitle = this.find('#listName').value; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - if (actionSelected === 'top') { + return [ + { + 'click .js-create-card-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const cardName = this.find('#card-name').value; + const listName = this.find('#list-name').value; + const swimlaneName = this.find('#swimlane-name2').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); const triggerId = Triggers.insert(trigger); const actionId = Actions.insert({ - actionType: 'moveCardToTop', - listTitle, + actionType: 'createCard', + swimlaneName, + cardName, + listName, boardId, desc, }); @@ -72,12 +27,17 @@ BlazeComponent.extendComponent({ actionId, boardId, }); - } - if (actionSelected === 'bottom') { + }, + 'click .js-add-swimlane-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const swimlaneName = this.find('#swimlane-name').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); const triggerId = Triggers.insert(trigger); const actionId = Actions.insert({ - actionType: 'moveCardToBottom', - listTitle, + actionType: 'addSwimlane', + swimlaneName, boardId, desc, }); @@ -87,82 +47,119 @@ BlazeComponent.extendComponent({ actionId, boardId, }); - } + }, + 'click .js-add-spec-move-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const actionSelected = this.find('#move-spec-action').value; + const listTitle = this.find('#listName').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + if (actionSelected === 'top') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'moveCardToTop', + listTitle, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'bottom') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'moveCardToBottom', + listTitle, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, + 'click .js-add-gen-move-action'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const boardId = Session.get('currentBoard'); + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const actionSelected = this.find('#move-gen-action').value; + if (actionSelected === 'top') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'moveCardToTop', + listTitle: '*', + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'bottom') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'moveCardToBottom', + listTitle: '*', + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, + 'click .js-add-arch-action'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const boardId = Session.get('currentBoard'); + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const actionSelected = this.find('#arch-action').value; + if (actionSelected === 'archive') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'archive', + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'unarchive') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'unarchive', + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, }, - 'click .js-add-gen-move-action' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const boardId = Session.get('currentBoard'); - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const actionSelected = this.find('#move-gen-action').value; - if (actionSelected === 'top') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'moveCardToTop', - 'listTitle': '*', - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - if (actionSelected === 'bottom') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'moveCardToBottom', - 'listTitle': '*', - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - }, - 'click .js-add-arch-action' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const boardId = Session.get('currentBoard'); - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const actionSelected = this.find('#arch-action').value; - if (actionSelected === 'archive') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'archive', - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - if (actionSelected === 'unarchive') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'unarchive', - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - }, - }]; + ]; }, - }).register('boardActions'); /* eslint-no-undef */ diff --git a/client/components/rules/actions/cardActions.js b/client/components/rules/actions/cardActions.js index d6e11eea..7dc6c2b5 100644 --- a/client/components/rules/actions/cardActions.js +++ b/client/components/rules/actions/cardActions.js @@ -14,7 +14,7 @@ BlazeComponent.extendComponent({ }, cardColorButtonText() { - return `color-${ this.cardColorButtonValue.get() }`; + return `color-${this.cardColorButtonValue.get()}`; }, labels() { @@ -28,106 +28,143 @@ 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(); - const actionSelected = this.find('#label-action').value; - const labelId = this.find('#label-id').value; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - if (actionSelected === 'add') { + 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: 'addLabel', - labelId, + actionType: actionSelected, + dateField: dateFieldSelected, boardId, desc, }); + Rules.insert({ title: ruleName, triggerId, actionId, boardId, + desc, }); - } - if (actionSelected === 'remove') { + }, + + '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: 'removeLabel', - labelId, + actionType: 'removeDate', + dateField: dateFieldSelected, boardId, desc, }); + Rules.insert({ title: ruleName, triggerId, actionId, boardId, + desc, }); - } - - }, - 'click .js-add-member-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const actionSelected = this.find('#member-action').value; - const username = this.find('#member-name').value; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - if (actionSelected === 'add') { + }, + 'click .js-add-label-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const actionSelected = this.find('#label-action').value; + const labelId = this.find('#label-id').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + if (actionSelected === 'add') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'addLabel', + labelId, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'remove') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'removeLabel', + labelId, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, + 'click .js-add-member-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const actionSelected = this.find('#member-action').value; + const username = this.find('#member-name').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + if (actionSelected === 'add') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'addMember', + username, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + desc, + }); + } + if (actionSelected === 'remove') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'removeMember', + username, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, + 'click .js-add-removeall-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); const triggerId = Triggers.insert(trigger); + const desc = Utils.getTriggerActionDesc(event, this); + const boardId = Session.get('currentBoard'); const actionId = Actions.insert({ - actionType: 'addMember', - username, + actionType: 'removeMember', + username: '*', boardId, desc, }); @@ -136,14 +173,26 @@ BlazeComponent.extendComponent({ triggerId, actionId, boardId, - desc, }); - } - if (actionSelected === 'remove') { + }, + 'click .js-show-color-palette'(event) { + const funct = Popup.open('setCardActionsColor'); + const colorButton = this.find('#color-action'); + if (colorButton.value === '') { + colorButton.value = 'green'; + } + funct.call(this, event); + }, + 'click .js-set-color-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const selectedColor = this.cardColorButtonValue.get(); + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); const triggerId = Triggers.insert(trigger); const actionId = Actions.insert({ - actionType: 'removeMember', - username, + actionType: 'setColor', + selectedColor, boardId, desc, }); @@ -153,58 +202,10 @@ BlazeComponent.extendComponent({ actionId, boardId, }); - } - }, - 'click .js-add-removeall-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const triggerId = Triggers.insert(trigger); - const desc = Utils.getTriggerActionDesc(event, this); - const boardId = Session.get('currentBoard'); - const actionId = Actions.insert({ - actionType: 'removeMember', - 'username': '*', - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - }, - 'click .js-show-color-palette'(event){ - const funct = Popup.open('setCardActionsColor'); - const colorButton = this.find('#color-action'); - if (colorButton.value === '') { - colorButton.value = 'green'; - } - funct.call(this, event); + }, }, - 'click .js-set-color-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const selectedColor = this.cardColorButtonValue.get(); - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'setColor', - selectedColor, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - }, - }]; + ]; }, - }).register('cardActions'); BlazeComponent.extendComponent({ @@ -215,7 +216,7 @@ BlazeComponent.extendComponent({ }, colors() { - return cardColors.map((color) => ({ color, name: '' })); + return cardColors.map(color => ({ color, name: '' })); }, isSelected(color) { @@ -223,14 +224,16 @@ BlazeComponent.extendComponent({ }, events() { - return [{ - 'click .js-palette-color'() { - this.currentColor.set(this.currentData().color); - }, - 'click .js-submit' () { - this.colorButtonValue.set(this.currentColor.get()); - Popup.close(); + return [ + { + 'click .js-palette-color'() { + this.currentColor.set(this.currentData().color); + }, + 'click .js-submit'() { + this.colorButtonValue.set(this.currentColor.get()); + Popup.close(); + }, }, - }]; + ]; }, }).register('setCardActionsColorPopup'); diff --git a/client/components/rules/actions/checklistActions.js b/client/components/rules/actions/checklistActions.js index 3e79b075..64908ab1 100644 --- a/client/components/rules/actions/checklistActions.js +++ b/client/components/rules/actions/checklistActions.js @@ -3,137 +3,20 @@ BlazeComponent.extendComponent({ this.subscribe('allRules'); }, events() { - return [{ - 'click .js-add-checklist-items-action' (event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const checklistName = this.find('#checklist-name-3').value; - const checklistItems = this.find('#checklist-items').value; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'addChecklistWithItems', - checklistName, - checklistItems, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - - }, - '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; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - if (actionSelected === 'add') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'addChecklist', - checklistName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - if (actionSelected === 'remove') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'removeChecklist', - checklistName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - - }, - '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; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - if (actionSelected === 'check') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'checkAll', - checklistName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - if (actionSelected === 'uncheck') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'uncheckAll', - checklistName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - }, - '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; - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - if (actionSelected === 'check') { - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({ - actionType: 'checkItem', - checklistName, - checkItemName, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); - } - if (actionSelected === 'uncheck') { + return [ + { + 'click .js-add-checklist-items-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const checklistName = this.find('#checklist-name-3').value; + const checklistItems = this.find('#checklist-items').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); const triggerId = Triggers.insert(trigger); const actionId = Actions.insert({ - actionType: 'uncheckItem', + actionType: 'addChecklistWithItems', checklistName, - checkItemName, + checklistItems, boardId, desc, }); @@ -143,9 +26,125 @@ BlazeComponent.extendComponent({ actionId, boardId, }); - } + }, + '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; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + if (actionSelected === 'add') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'addChecklist', + checklistName, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'remove') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'removeChecklist', + checklistName, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, + '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; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + if (actionSelected === 'check') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'checkAll', + checklistName, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'uncheck') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'uncheckAll', + checklistName, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, + '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; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + if (actionSelected === 'check') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'checkItem', + checklistName, + checkItemName, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + if (actionSelected === 'uncheck') { + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({ + actionType: 'uncheckItem', + checklistName, + checkItemName, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + } + }, }, - }]; + ]; }, - }).register('checklistActions'); diff --git a/client/components/rules/actions/mailActions.js b/client/components/rules/actions/mailActions.js index 40cbc280..87cb925c 100644 --- a/client/components/rules/actions/mailActions.js +++ b/client/components/rules/actions/mailActions.js @@ -1,35 +1,34 @@ BlazeComponent.extendComponent({ - onCreated() { - - }, + onCreated() {}, events() { - return [{ - 'click .js-mail-action' (event) { - const emailTo = this.find('#email-to').value; - const emailSubject = this.find('#email-subject').value; - const emailMsg = this.find('#email-msg').value; - const trigger = this.data().triggerVar.get(); - const ruleName = this.data().ruleName.get(); - const triggerId = Triggers.insert(trigger); - const boardId = Session.get('currentBoard'); - const desc = Utils.getTriggerActionDesc(event, this); - const actionId = Actions.insert({ - actionType: 'sendEmail', - emailTo, - emailSubject, - emailMsg, - boardId, - desc, - }); - Rules.insert({ - title: ruleName, - triggerId, - actionId, - boardId, - }); + return [ + { + 'click .js-mail-action'(event) { + const emailTo = this.find('#email-to').value; + const emailSubject = this.find('#email-subject').value; + const emailMsg = this.find('#email-msg').value; + const trigger = this.data().triggerVar.get(); + const ruleName = this.data().ruleName.get(); + const triggerId = Triggers.insert(trigger); + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event, this); + const actionId = Actions.insert({ + actionType: 'sendEmail', + emailTo, + emailSubject, + emailMsg, + boardId, + desc, + }); + Rules.insert({ + title: ruleName, + triggerId, + actionId, + boardId, + }); + }, }, - }]; + ]; }, - }).register('mailActions'); -- cgit v1.2.3-1-g7c22