diff options
Diffstat (limited to 'client/components/rules/triggers/cardTriggers.js')
-rw-r--r-- | client/components/rules/triggers/cardTriggers.js | 226 |
1 files changed, 114 insertions, 112 deletions
diff --git a/client/components/rules/triggers/cardTriggers.js b/client/components/rules/triggers/cardTriggers.js index 82b21d61..8d4ec52e 100644 --- a/client/components/rules/triggers/cardTriggers.js +++ b/client/components/rules/triggers/cardTriggers.js @@ -7,7 +7,7 @@ BlazeComponent.extendComponent({ for (let i = 0; i < labels.length; i++) { if (labels[i].name === '' || labels[i].name === undefined) { labels[i].name = labels[i].color; - labels[i].translatedname = `${TAPi18n.__(`color-${ labels[i].color}`)}`; + labels[i].translatedname = `${TAPi18n.__(`color-${labels[i].color}`)}`; } else { labels[i].translatedname = labels[i].name; } @@ -15,117 +15,119 @@ BlazeComponent.extendComponent({ return labels; }, events() { - return [{ - 'click .js-add-gen-label-trigger' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const datas = this.data(); - const actionSelected = this.find('#label-action').value; - const boardId = Session.get('currentBoard'); - if (actionSelected === 'added') { - datas.triggerVar.set({ - activityType: 'addedLabel', - boardId, - 'labelId': '*', - desc, - }); - } - if (actionSelected === 'removed') { - datas.triggerVar.set({ - activityType: 'removedLabel', - boardId, - 'labelId': '*', - desc, - }); - } + return [ + { + 'click .js-add-gen-label-trigger'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const datas = this.data(); + const actionSelected = this.find('#label-action').value; + const boardId = Session.get('currentBoard'); + if (actionSelected === 'added') { + datas.triggerVar.set({ + activityType: 'addedLabel', + boardId, + labelId: '*', + desc, + }); + } + if (actionSelected === 'removed') { + datas.triggerVar.set({ + activityType: 'removedLabel', + boardId, + labelId: '*', + desc, + }); + } + }, + 'click .js-add-spec-label-trigger'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const datas = this.data(); + const actionSelected = this.find('#spec-label-action').value; + const labelId = this.find('#spec-label').value; + const boardId = Session.get('currentBoard'); + if (actionSelected === 'added') { + datas.triggerVar.set({ + activityType: 'addedLabel', + boardId, + labelId, + desc, + }); + } + if (actionSelected === 'removed') { + datas.triggerVar.set({ + activityType: 'removedLabel', + boardId, + labelId, + desc, + }); + } + }, + 'click .js-add-gen-member-trigger'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const datas = this.data(); + const actionSelected = this.find('#gen-member-action').value; + const boardId = Session.get('currentBoard'); + if (actionSelected === 'added') { + datas.triggerVar.set({ + activityType: 'joinMember', + boardId, + username: '*', + desc, + }); + } + if (actionSelected === 'removed') { + datas.triggerVar.set({ + activityType: 'unjoinMember', + boardId, + username: '*', + desc, + }); + } + }, + 'click .js-add-spec-member-trigger'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const datas = this.data(); + const actionSelected = this.find('#spec-member-action').value; + const username = this.find('#spec-member').value; + const boardId = Session.get('currentBoard'); + if (actionSelected === 'added') { + datas.triggerVar.set({ + activityType: 'joinMember', + boardId, + username, + desc, + }); + } + if (actionSelected === 'removed') { + datas.triggerVar.set({ + activityType: 'unjoinMember', + boardId, + username, + desc, + }); + } + }, + 'click .js-add-attachment-trigger'(event) { + const desc = Utils.getTriggerActionDesc(event, this); + const datas = this.data(); + const actionSelected = this.find('#attach-action').value; + const boardId = Session.get('currentBoard'); + if (actionSelected === 'added') { + datas.triggerVar.set({ + activityType: 'addAttachment', + boardId, + desc, + }); + } + if (actionSelected === 'removed') { + datas.triggerVar.set({ + activityType: 'deleteAttachment', + boardId, + desc, + }); + } + }, }, - 'click .js-add-spec-label-trigger' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const datas = this.data(); - const actionSelected = this.find('#spec-label-action').value; - const labelId = this.find('#spec-label').value; - const boardId = Session.get('currentBoard'); - if (actionSelected === 'added') { - datas.triggerVar.set({ - activityType: 'addedLabel', - boardId, - labelId, - desc, - }); - } - if (actionSelected === 'removed') { - datas.triggerVar.set({ - activityType: 'removedLabel', - boardId, - labelId, - desc, - }); - } - }, - 'click .js-add-gen-member-trigger' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const datas = this.data(); - const actionSelected = this.find('#gen-member-action').value; - const boardId = Session.get('currentBoard'); - if (actionSelected === 'added') { - datas.triggerVar.set({ - activityType: 'joinMember', - boardId, - 'username': '*', - desc, - }); - } - if (actionSelected === 'removed') { - datas.triggerVar.set({ - activityType: 'unjoinMember', - boardId, - 'username': '*', - desc, - }); - } - }, - 'click .js-add-spec-member-trigger' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const datas = this.data(); - const actionSelected = this.find('#spec-member-action').value; - const username = this.find('#spec-member').value; - const boardId = Session.get('currentBoard'); - if (actionSelected === 'added') { - datas.triggerVar.set({ - activityType: 'joinMember', - boardId, - username, - desc, - }); - } - if (actionSelected === 'removed') { - datas.triggerVar.set({ - activityType: 'unjoinMember', - boardId, - username, - desc, - }); - } - }, - 'click .js-add-attachment-trigger' (event) { - const desc = Utils.getTriggerActionDesc(event, this); - const datas = this.data(); - const actionSelected = this.find('#attach-action').value; - const boardId = Session.get('currentBoard'); - if (actionSelected === 'added') { - datas.triggerVar.set({ - activityType: 'addAttachment', - boardId, - desc, - }); - } - if (actionSelected === 'removed') { - datas.triggerVar.set({ - activityType: 'deleteAttachment', - boardId, - desc, - }); - } - }, - }]; + ]; }, }).register('cardTriggers'); |