summaryrefslogtreecommitdiffstats
path: root/client/components/rules/triggers
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/rules/triggers')
-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
3 files changed, 344 insertions, 339 deletions
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');