summaryrefslogtreecommitdiffstats
path: root/client/components/rules/triggers
diff options
context:
space:
mode:
authorAngelo Gallarello <angelo.gallarell@gmail.com>2018-09-14 17:35:14 +0200
committerAngelo Gallarello <angelo.gallarell@gmail.com>2018-09-14 17:35:14 +0200
commit30a3daa6af179009ac17b40a71bf3f9e9b1d698a (patch)
tree16e2ecdc589aa67367f3d53a44c1eaba8ba1f637 /client/components/rules/triggers
parentfc73dc5bbcbbd203efc4f10ecb4bd1a66e0d9efb (diff)
downloadwekan-30a3daa6af179009ac17b40a71bf3f9e9b1d698a.tar.gz
wekan-30a3daa6af179009ac17b40a71bf3f9e9b1d698a.tar.bz2
wekan-30a3daa6af179009ac17b40a71bf3f9e9b1d698a.zip
Finished alpha rules
Diffstat (limited to 'client/components/rules/triggers')
-rw-r--r--client/components/rules/triggers/cardTriggers.js184
-rw-r--r--client/components/rules/triggers/checklistTriggers.js36
2 files changed, 135 insertions, 85 deletions
diff --git a/client/components/rules/triggers/cardTriggers.js b/client/components/rules/triggers/cardTriggers.js
index e860d806..c0a5ec1a 100644
--- a/client/components/rules/triggers/cardTriggers.js
+++ b/client/components/rules/triggers/cardTriggers.js
@@ -2,12 +2,11 @@ BlazeComponent.extendComponent({
onCreated() {
this.subscribe('allRules');
},
-
- labels(){
+ labels() {
const labels = Boards.findOne(Session.get('currentBoard')).labels;
console.log(labels);
- for(let i = 0;i<labels.length;i++){
- if(labels[i].name == "" || labels[i].name == undefined){
+ for (let i = 0; i < labels.length; i++) {
+ if (labels[i].name == "" || labels[i].name == undefined) {
labels[i].name = labels[i].color.toUpperCase();
}
}
@@ -15,70 +14,117 @@ BlazeComponent.extendComponent({
return labels;
},
events() {
- return [
- {'click .js-add-gen-label-trigger'(event) {
-
- let datas = this.data();
- const actionSelected = this.find('#label-action').value;
- const boardId = Session.get('currentBoard')
- if(actionSelected == "added"){
- datas.triggerVar.set({activityType: "addedLabel","boardId":boardId,"labelId":"*"});
- }
- if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "removedLabel","boardId":boardId,"labelId":"*"});
- }
- },
- 'click .js-add-spec-label-trigger'(event) {
- let 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":boardId,"labelId":labelId});
- }
- if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "removedLabel","boardId":boardId,"labelId":labelId});
- }
- },
- 'click .js-add-gen-member-trigger'(event) {
-
- let 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":boardId,"memberId":"*"});
- }
- if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "unjoinMember","boardId":boardId,"memberId":"*"});
- }
- },
- 'click .js-add-spec-member-trigger'(event) {
- let datas = this.data();
- const actionSelected = this.find('#spec-member-action').value;
- const memberId = this.find('#spec-member').value;
- const boardId = Session.get('currentBoard')
- if(actionSelected == "added"){
- datas.triggerVar.set({activityType: "joinMember","boardId":boardId,"memberId":memberId});
- }
- if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "unjoinMember","boardId":boardId,"memberId":memberId});
- }
- },
- 'click .js-add-attachment-trigger'(event) {
-
- let datas = this.data();
- const actionSelected = this.find('#attach-action').value;
- const boardId = Session.get('currentBoard')
- if(actionSelected == "added"){
- datas.triggerVar.set({activityType: "addAttachment","boardId":boardId});
- }
- if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "deleteAttachment","boardId":boardId});
- }
- },
+ return [{
+ 'click .js-add-gen-label-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let datas = this.data();
+ const actionSelected = this.find('#label-action').value;
+ const boardId = Session.get('currentBoard')
+ if (actionSelected == "added") {
+ datas.triggerVar.set({
+ activityType: "addedLabel",
+ "boardId": boardId,
+ "labelId": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removedLabel",
+ "boardId": boardId,
+ "labelId": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-label-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "labelId": labelId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removedLabel",
+ "boardId": boardId,
+ "labelId": labelId,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-gen-member-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "memberId": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "unjoinMember",
+ "boardId": boardId,
+ "memberId": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-member-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let datas = this.data();
+ const actionSelected = this.find('#spec-member-action').value;
+ const memberId = this.find('#spec-member').value;
+ const boardId = Session.get('currentBoard')
+ if (actionSelected == "added") {
+ datas.triggerVar.set({
+ activityType: "joinMember",
+ "boardId": boardId,
+ "memberId": memberId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "unjoinMember",
+ "boardId": boardId,
+ "memberId": memberId,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-attachment-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let datas = this.data();
+ const actionSelected = this.find('#attach-action').value;
+ const boardId = Session.get('currentBoard')
+ if (actionSelected == "added") {
+ datas.triggerVar.set({
+ activityType: "addAttachment",
+ "boardId": boardId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "deleteAttachment",
+ "boardId": boardId,
+ "desc": desc
+ });
+ }
+ },
}];
},
-
-}).register('cardTriggers');
-
-
+}).register('cardTriggers'); \ No newline at end of file
diff --git a/client/components/rules/triggers/checklistTriggers.js b/client/components/rules/triggers/checklistTriggers.js
index b790aff4..15a1cf34 100644
--- a/client/components/rules/triggers/checklistTriggers.js
+++ b/client/components/rules/triggers/checklistTriggers.js
@@ -5,79 +5,83 @@ BlazeComponent.extendComponent({
events() {
return [
{'click .js-add-gen-check-trigger'(event) {
-
+ const desc = Utils.getTriggerActionDesc(event,this);
let 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":boardId,"checklistName":"*"});
+ datas.triggerVar.set({activityType: "addChecklist","boardId":boardId,"checklistName":"*","desc":desc});
}
if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "removeChecklist","boardId":boardId,"checklistName":"*"});
+ datas.triggerVar.set({activityType: "removeChecklist","boardId":boardId,"checklistName":"*","desc":desc});
}
},
'click .js-add-spec-check-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event,this);
let 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":boardId,"checklistName":checklistId});
+ datas.triggerVar.set({activityType: "addChecklist","boardId":boardId,"checklistName":checklistId,"desc":desc});
}
if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId});
+ datas.triggerVar.set({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId,"desc":desc});
}
},
'click .js-add-gen-comp-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event,this);
let 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":boardId,"checklistName":"*"});
+ datas.triggerVar.set({activityType: "completeChecklist","boardId":boardId,"checklistName":"*","desc":desc});
}
if(actionSelected == "uncompleted"){
- datas.triggerVar.set({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*"});
+ datas.triggerVar.set({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*","desc":desc});
}
},
'click .js-add-spec-comp-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event,this);
let 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 == "added"){
- datas.triggerVar.set({activityType: "completeChecklist","boardId":boardId,"checklistName":checklistId});
+ datas.triggerVar.set({activityType: "completeChecklist","boardId":boardId,"checklistName":checklistId,"desc":desc});
}
if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":checklistId});
+ datas.triggerVar.set({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":checklistId,"desc":desc});
}
},
'click .js-add-gen-check-item-trigger'(event) {
-
+ const desc = Utils.getTriggerActionDesc(event,this);
let 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":boardId,"checklistItemName":"*"});
+ datas.triggerVar.set({activityType: "checkedItem","boardId":boardId,"checklistItemName":"*","desc":desc});
}
if(actionSelected == "unchecked"){
- datas.triggerVar.set({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*"});
+ datas.triggerVar.set({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*","desc":desc});
}
},
'click .js-add-spec-check-item-trigger'(event) {
+ const desc = Utils.getTriggerActionDesc(event,this);
let 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":boardId,"checklistItemName":checklistItemId});
+ datas.triggerVar.set({activityType: "checkedItem","boardId":boardId,"checklistItemName":checklistItemId,"desc":desc});
}
if(actionSelected == "unchecked"){
- datas.triggerVar.set({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":checklistItemId});
+ datas.triggerVar.set({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":checklistItemId,"desc":desc});
}
},
- }];
- },
+ }];
+},
}).register('checklistTriggers');