summaryrefslogtreecommitdiffstats
path: root/client/components/rules
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/rules')
-rw-r--r--client/components/rules/actions/boardActions.js275
-rw-r--r--client/components/rules/actions/cardActions.js285
-rw-r--r--client/components/rules/actions/checklistActions.js261
-rw-r--r--client/components/rules/actions/mailActions.js57
-rw-r--r--client/components/rules/ruleDetails.js2
-rw-r--r--client/components/rules/rulesActions.js28
-rw-r--r--client/components/rules/rulesMain.js136
-rw-r--r--client/components/rules/rulesTriggers.js22
-rw-r--r--client/components/rules/triggers/boardTriggers.js182
-rw-r--r--client/components/rules/triggers/cardTriggers.js226
-rw-r--r--client/components/rules/triggers/checklistTriggers.js275
11 files changed, 879 insertions, 870 deletions
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');
diff --git a/client/components/rules/ruleDetails.js b/client/components/rules/ruleDetails.js
index 17c86dc3..f0e13de3 100644
--- a/client/components/rules/ruleDetails.js
+++ b/client/components/rules/ruleDetails.js
@@ -3,7 +3,6 @@ BlazeComponent.extendComponent({
this.subscribe('allRules');
this.subscribe('allTriggers');
this.subscribe('allActions');
-
},
trigger() {
@@ -34,5 +33,4 @@ BlazeComponent.extendComponent({
events() {
return [{}];
},
-
}).register('ruleDetails');
diff --git a/client/components/rules/rulesActions.js b/client/components/rules/rulesActions.js
index 64a5c70e..9b4f3a71 100644
--- a/client/components/rules/rulesActions.js
+++ b/client/components/rules/rulesActions.js
@@ -40,19 +40,21 @@ BlazeComponent.extendComponent({
// console.log(this.data());
},
events() {
- return [{
- 'click .js-set-board-actions'(){
- this.setBoardActions();
+ return [
+ {
+ 'click .js-set-board-actions'() {
+ this.setBoardActions();
+ },
+ 'click .js-set-card-actions'() {
+ this.setCardActions();
+ },
+ 'click .js-set-mail-actions'() {
+ this.setMailActions();
+ },
+ 'click .js-set-checklist-actions'() {
+ this.setChecklistActions();
+ },
},
- 'click .js-set-card-actions'() {
- this.setCardActions();
- },
- 'click .js-set-mail-actions'() {
- this.setMailActions();
- },
- 'click .js-set-checklist-actions'() {
- this.setChecklistActions();
- },
- }];
+ ];
},
}).register('rulesActions');
diff --git a/client/components/rules/rulesMain.js b/client/components/rules/rulesMain.js
index d4af38f4..99091490 100644
--- a/client/components/rules/rulesMain.js
+++ b/client/components/rules/rulesMain.js
@@ -9,12 +9,12 @@ BlazeComponent.extendComponent({
setTrigger() {
this.rulesCurrentTab.set('trigger');
},
- sanitizeObject(obj){
- Object.keys(obj).forEach((key) => {
- if(obj[key] === '' || obj[key] === undefined){
+ sanitizeObject(obj) {
+ Object.keys(obj).forEach(key => {
+ if (obj[key] === '' || obj[key] === undefined) {
obj[key] = '*';
- }}
- );
+ }
+ });
},
setRulesList() {
this.rulesCurrentTab.set('rulesList');
@@ -29,69 +29,73 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-delete-rule' () {
- const rule = this.currentData();
- Rules.remove(rule._id);
- Actions.remove(rule.actionId);
- Triggers.remove(rule.triggerId);
-
- },
- 'click .js-goto-trigger' (event) {
- event.preventDefault();
- const ruleTitle = this.find('#ruleTitle').value;
- if(ruleTitle !== undefined && ruleTitle !== ''){
- this.find('#ruleTitle').value = '';
- this.ruleName.set(ruleTitle);
- this.setTrigger();
- }
- },
- 'click .js-goto-action' (event) {
- event.preventDefault();
- // Add user to the trigger
- const username = $(event.currentTarget.offsetParent).find('.user-name').val();
- let trigger = this.triggerVar.get();
- trigger.userId = '*';
- if(username !== undefined ){
- const userFound = Users.findOne({username});
- if(userFound !== undefined){
- trigger.userId = userFound._id;
- this.triggerVar.set(trigger);
+ return [
+ {
+ 'click .js-delete-rule'() {
+ const rule = this.currentData();
+ Rules.remove(rule._id);
+ Actions.remove(rule.actionId);
+ Triggers.remove(rule.triggerId);
+ },
+ 'click .js-goto-trigger'(event) {
+ event.preventDefault();
+ const ruleTitle = this.find('#ruleTitle').value;
+ if (ruleTitle !== undefined && ruleTitle !== '') {
+ this.find('#ruleTitle').value = '';
+ this.ruleName.set(ruleTitle);
+ this.setTrigger();
}
- }
- // Sanitize trigger
- trigger = this.triggerVar.get();
- this.sanitizeObject(trigger);
- this.triggerVar.set(trigger);
- this.setAction();
- },
- 'click .js-show-user-field' (event) {
- event.preventDefault();
- $(event.currentTarget.offsetParent).find('.user-details').removeClass('hide-element');
- },
- 'click .js-goto-rules' (event) {
- event.preventDefault();
- this.setRulesList();
- },
- 'click .js-goback' (event) {
- event.preventDefault();
- if(this.rulesCurrentTab.get() === 'trigger' || this.rulesCurrentTab.get() === 'ruleDetails' ){
+ },
+ 'click .js-goto-action'(event) {
+ event.preventDefault();
+ // Add user to the trigger
+ const username = $(event.currentTarget.offsetParent)
+ .find('.user-name')
+ .val();
+ let trigger = this.triggerVar.get();
+ trigger.userId = '*';
+ if (username !== undefined) {
+ const userFound = Users.findOne({ username });
+ if (userFound !== undefined) {
+ trigger.userId = userFound._id;
+ this.triggerVar.set(trigger);
+ }
+ }
+ // Sanitize trigger
+ trigger = this.triggerVar.get();
+ this.sanitizeObject(trigger);
+ this.triggerVar.set(trigger);
+ this.setAction();
+ },
+ 'click .js-show-user-field'(event) {
+ event.preventDefault();
+ $(event.currentTarget.offsetParent)
+ .find('.user-details')
+ .removeClass('hide-element');
+ },
+ 'click .js-goto-rules'(event) {
+ event.preventDefault();
this.setRulesList();
- }
- if(this.rulesCurrentTab.get() === 'action'){
- this.setTrigger();
- }
- },
- 'click .js-goto-details' (event) {
- event.preventDefault();
- const rule = this.currentData();
- this.ruleId.set(rule._id);
- this.setRuleDetails();
+ },
+ 'click .js-goback'(event) {
+ event.preventDefault();
+ if (
+ this.rulesCurrentTab.get() === 'trigger' ||
+ this.rulesCurrentTab.get() === 'ruleDetails'
+ ) {
+ this.setRulesList();
+ }
+ if (this.rulesCurrentTab.get() === 'action') {
+ this.setTrigger();
+ }
+ },
+ 'click .js-goto-details'(event) {
+ event.preventDefault();
+ const rule = this.currentData();
+ this.ruleId.set(rule._id);
+ this.setRuleDetails();
+ },
},
-
- }];
+ ];
},
-
}).register('rulesMain');
-
-
diff --git a/client/components/rules/rulesTriggers.js b/client/components/rules/rulesTriggers.js
index e3c16221..a502fd37 100644
--- a/client/components/rules/rulesTriggers.js
+++ b/client/components/rules/rulesTriggers.js
@@ -38,16 +38,18 @@ BlazeComponent.extendComponent({
// console.log(this.data());
},
events() {
- return [{
- 'click .js-set-board-triggers' () {
- this.setBoardTriggers();
+ return [
+ {
+ 'click .js-set-board-triggers'() {
+ this.setBoardTriggers();
+ },
+ 'click .js-set-card-triggers'() {
+ this.setCardTriggers();
+ },
+ 'click .js-set-checklist-triggers'() {
+ this.setChecklistTriggers();
+ },
},
- 'click .js-set-card-triggers' () {
- this.setCardTriggers();
- },
- 'click .js-set-checklist-triggers' () {
- this.setChecklistTriggers();
- },
- }];
+ ];
},
}).register('rulesTriggers');
diff --git a/client/components/rules/triggers/boardTriggers.js b/client/components/rules/triggers/boardTriggers.js
index 1dc5c437..66ee337a 100644
--- a/client/components/rules/triggers/boardTriggers.js
+++ b/client/components/rules/triggers/boardTriggers.js
@@ -4,116 +4,118 @@ BlazeComponent.extendComponent({
this.currentPopupTriggerId = 'def';
this.cardTitleFilters = {};
},
- setNameFilter(name){
- this.cardTitleFilters[this.currentPopupTriggerId] = name;
+ setNameFilter(name) {
+ this.cardTitleFilters[this.currentPopupTriggerId] = name;
},
events() {
- return [{
- 'click .js-open-card-title-popup'(event){
- const funct = Popup.open('boardCardTitle');
- const divId = $(event.currentTarget.parentNode.parentNode).attr('id');
- //console.log('current popup');
- //console.log(this.currentPopupTriggerId);
- this.currentPopupTriggerId = divId;
- funct.call(this, event);
- },
- 'click .js-add-create-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const listName = this.find('#create-list-name').value;
- const swimlaneName = this.find('#create-swimlane-name').value;
- const boardId = Session.get('currentBoard');
- const divId = $(event.currentTarget.parentNode).attr('id');
- const cardTitle = this.cardTitleFilters[divId];
- // move to generic funciont
- datas.triggerVar.set({
- activityType: 'createCard',
- boardId,
- cardTitle,
- swimlaneName,
- listName,
- desc,
- });
- },
- 'click .js-add-moved-trigger' (event) {
- const datas = this.data();
- const desc = Utils.getTriggerActionDesc(event, this);
- const swimlaneName = this.find('#create-swimlane-name-2').value;
- const actionSelected = this.find('#move-action').value;
- const listName = this.find('#move-list-name').value;
- const boardId = Session.get('currentBoard');
- const divId = $(event.currentTarget.parentNode).attr('id');
- const cardTitle = this.cardTitleFilters[divId];
- if (actionSelected === 'moved-to') {
+ return [
+ {
+ 'click .js-open-card-title-popup'(event) {
+ const funct = Popup.open('boardCardTitle');
+ const divId = $(event.currentTarget.parentNode.parentNode).attr('id');
+ //console.log('current popup');
+ //console.log(this.currentPopupTriggerId);
+ this.currentPopupTriggerId = divId;
+ funct.call(this, event);
+ },
+ 'click .js-add-create-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const datas = this.data();
+ const listName = this.find('#create-list-name').value;
+ const swimlaneName = this.find('#create-swimlane-name').value;
+ const boardId = Session.get('currentBoard');
+ const divId = $(event.currentTarget.parentNode).attr('id');
+ const cardTitle = this.cardTitleFilters[divId];
+ // move to generic funciont
datas.triggerVar.set({
- activityType: 'moveCard',
- boardId,
- listName,
- cardTitle,
- swimlaneName,
- 'oldListName': '*',
- desc,
- });
- }
- if (actionSelected === 'moved-from') {
- datas.triggerVar.set({
- activityType: 'moveCard',
+ activityType: 'createCard',
boardId,
cardTitle,
swimlaneName,
- 'listName': '*',
- 'oldListName': listName,
+ listName,
desc,
});
- }
- },
- 'click .js-add-gen-moved-trigger' (event){
- const datas = this.data();
- const desc = Utils.getTriggerActionDesc(event, this);
- const boardId = Session.get('currentBoard');
+ },
+ 'click .js-add-moved-trigger'(event) {
+ const datas = this.data();
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const swimlaneName = this.find('#create-swimlane-name-2').value;
+ const actionSelected = this.find('#move-action').value;
+ const listName = this.find('#move-list-name').value;
+ const boardId = Session.get('currentBoard');
+ const divId = $(event.currentTarget.parentNode).attr('id');
+ const cardTitle = this.cardTitleFilters[divId];
+ if (actionSelected === 'moved-to') {
+ datas.triggerVar.set({
+ activityType: 'moveCard',
+ boardId,
+ listName,
+ cardTitle,
+ swimlaneName,
+ oldListName: '*',
+ desc,
+ });
+ }
+ if (actionSelected === 'moved-from') {
+ datas.triggerVar.set({
+ activityType: 'moveCard',
+ boardId,
+ cardTitle,
+ swimlaneName,
+ listName: '*',
+ oldListName: listName,
+ desc,
+ });
+ }
+ },
+ 'click .js-add-gen-moved-trigger'(event) {
+ const datas = this.data();
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const boardId = Session.get('currentBoard');
- datas.triggerVar.set({
- 'activityType': 'moveCard',
- boardId,
- 'swimlaneName': '*',
- 'listName':'*',
- 'oldListName': '*',
- desc,
- });
- },
- 'click .js-add-arc-trigger' (event) {
- const datas = this.data();
- const desc = Utils.getTriggerActionDesc(event, this);
- const actionSelected = this.find('#arch-action').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'archived') {
datas.triggerVar.set({
- activityType: 'archivedCard',
- boardId,
- desc,
- });
- }
- if (actionSelected === 'unarchived') {
- datas.triggerVar.set({
- activityType: 'restoredCard',
+ activityType: 'moveCard',
boardId,
+ swimlaneName: '*',
+ listName: '*',
+ oldListName: '*',
desc,
});
- }
+ },
+ 'click .js-add-arc-trigger'(event) {
+ const datas = this.data();
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const actionSelected = this.find('#arch-action').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'archived') {
+ datas.triggerVar.set({
+ activityType: 'archivedCard',
+ boardId,
+ desc,
+ });
+ }
+ if (actionSelected === 'unarchived') {
+ datas.triggerVar.set({
+ activityType: 'restoredCard',
+ boardId,
+ desc,
+ });
+ }
+ },
},
-
- }];
+ ];
},
-
}).register('boardTriggers');
-
Template.boardCardTitlePopup.events({
- submit(evt, tpl) {
- const title = tpl.$('.js-card-filter-name').val().trim();
+ submit(event, templateInstance) {
+ const title = templateInstance
+ .$('.js-card-filter-name')
+ .val()
+ .trim();
Popup.getOpenerComponent().setNameFilter(title);
- evt.preventDefault();
+ event.preventDefault();
Popup.close();
},
});
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');
diff --git a/client/components/rules/triggers/checklistTriggers.js b/client/components/rules/triggers/checklistTriggers.js
index 2272be29..9b2cd99c 100644
--- a/client/components/rules/triggers/checklistTriggers.js
+++ b/client/components/rules/triggers/checklistTriggers.js
@@ -3,144 +3,145 @@ BlazeComponent.extendComponent({
this.subscribe('allRules');
},
events() {
- return [{
- 'click .js-add-gen-check-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const actionSelected = this.find('#gen-check-action').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'created') {
- datas.triggerVar.set({
- activityType: 'addChecklist',
- boardId,
- 'checklistName': '*',
- desc,
- });
- }
- if (actionSelected === 'removed') {
- datas.triggerVar.set({
- activityType: 'removeChecklist',
- boardId,
- 'checklistName': '*',
- desc,
- });
- }
- },
- 'click .js-add-spec-check-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const actionSelected = this.find('#spec-check-action').value;
- const checklistId = this.find('#check-name').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'created') {
- datas.triggerVar.set({
- activityType: 'addChecklist',
- boardId,
- 'checklistName': checklistId,
- desc,
- });
- }
- if (actionSelected === 'removed') {
- datas.triggerVar.set({
- activityType: 'removeChecklist',
- boardId,
- 'checklistName': checklistId,
- desc,
- });
- }
- },
- 'click .js-add-gen-comp-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
+ return [
+ {
+ 'click .js-add-gen-check-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const datas = this.data();
+ const actionSelected = this.find('#gen-check-action').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'created') {
+ datas.triggerVar.set({
+ activityType: 'addChecklist',
+ boardId,
+ checklistName: '*',
+ desc,
+ });
+ }
+ if (actionSelected === 'removed') {
+ datas.triggerVar.set({
+ activityType: 'removeChecklist',
+ boardId,
+ checklistName: '*',
+ desc,
+ });
+ }
+ },
+ 'click .js-add-spec-check-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const datas = this.data();
+ const actionSelected = this.find('#spec-check-action').value;
+ const checklistId = this.find('#check-name').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'created') {
+ datas.triggerVar.set({
+ activityType: 'addChecklist',
+ boardId,
+ checklistName: checklistId,
+ desc,
+ });
+ }
+ if (actionSelected === 'removed') {
+ datas.triggerVar.set({
+ activityType: 'removeChecklist',
+ boardId,
+ checklistName: checklistId,
+ desc,
+ });
+ }
+ },
+ 'click .js-add-gen-comp-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const actionSelected = this.find('#gen-comp-check-action').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'completed') {
- datas.triggerVar.set({
- activityType: 'completeChecklist',
- boardId,
- 'checklistName': '*',
- desc,
- });
- }
- if (actionSelected === 'uncompleted') {
- datas.triggerVar.set({
- activityType: 'uncompleteChecklist',
- boardId,
- 'checklistName': '*',
- desc,
- });
- }
- },
- 'click .js-add-spec-comp-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const actionSelected = this.find('#spec-comp-check-action').value;
- const checklistId = this.find('#spec-comp-check-name').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'completed') {
- datas.triggerVar.set({
- activityType: 'completeChecklist',
- boardId,
- 'checklistName': checklistId,
- desc,
- });
- }
- if (actionSelected === 'uncompleted') {
- datas.triggerVar.set({
- activityType: 'uncompleteChecklist',
- boardId,
- 'checklistName': checklistId,
- desc,
- });
- }
+ const datas = this.data();
+ const actionSelected = this.find('#gen-comp-check-action').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'completed') {
+ datas.triggerVar.set({
+ activityType: 'completeChecklist',
+ boardId,
+ checklistName: '*',
+ desc,
+ });
+ }
+ if (actionSelected === 'uncompleted') {
+ datas.triggerVar.set({
+ activityType: 'uncompleteChecklist',
+ boardId,
+ checklistName: '*',
+ desc,
+ });
+ }
+ },
+ 'click .js-add-spec-comp-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const datas = this.data();
+ const actionSelected = this.find('#spec-comp-check-action').value;
+ const checklistId = this.find('#spec-comp-check-name').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'completed') {
+ datas.triggerVar.set({
+ activityType: 'completeChecklist',
+ boardId,
+ checklistName: checklistId,
+ desc,
+ });
+ }
+ if (actionSelected === 'uncompleted') {
+ datas.triggerVar.set({
+ activityType: 'uncompleteChecklist',
+ boardId,
+ checklistName: checklistId,
+ desc,
+ });
+ }
+ },
+ 'click .js-add-gen-check-item-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const datas = this.data();
+ const actionSelected = this.find('#check-item-gen-action').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'checked') {
+ datas.triggerVar.set({
+ activityType: 'checkedItem',
+ boardId,
+ checklistItemName: '*',
+ desc,
+ });
+ }
+ if (actionSelected === 'unchecked') {
+ datas.triggerVar.set({
+ activityType: 'uncheckedItem',
+ boardId,
+ checklistItemName: '*',
+ desc,
+ });
+ }
+ },
+ 'click .js-add-spec-check-item-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ const datas = this.data();
+ const actionSelected = this.find('#check-item-spec-action').value;
+ const checklistItemId = this.find('#check-item-name').value;
+ const boardId = Session.get('currentBoard');
+ if (actionSelected === 'checked') {
+ datas.triggerVar.set({
+ activityType: 'checkedItem',
+ boardId,
+ checklistItemName: checklistItemId,
+ desc,
+ });
+ }
+ if (actionSelected === 'unchecked') {
+ datas.triggerVar.set({
+ activityType: 'uncheckedItem',
+ boardId,
+ checklistItemName: checklistItemId,
+ desc,
+ });
+ }
+ },
},
- 'click .js-add-gen-check-item-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const actionSelected = this.find('#check-item-gen-action').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'checked') {
- datas.triggerVar.set({
- activityType: 'checkedItem',
- boardId,
- 'checklistItemName': '*',
- desc,
- });
- }
- if (actionSelected === 'unchecked') {
- datas.triggerVar.set({
- activityType: 'uncheckedItem',
- boardId,
- 'checklistItemName': '*',
- desc,
- });
- }
- },
- 'click .js-add-spec-check-item-trigger' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const datas = this.data();
- const actionSelected = this.find('#check-item-spec-action').value;
- const checklistItemId = this.find('#check-item-name').value;
- const boardId = Session.get('currentBoard');
- if (actionSelected === 'checked') {
- datas.triggerVar.set({
- activityType: 'checkedItem',
- boardId,
- 'checklistItemName': checklistItemId,
- desc,
- });
- }
- if (actionSelected === 'unchecked') {
- datas.triggerVar.set({
- activityType: 'uncheckedItem',
- boardId,
- 'checklistItemName': checklistItemId,
- desc,
- });
- }
- },
- }];
+ ];
},
-
}).register('checklistTriggers');