Completed rules

This commit is contained in:
Angelo Gallarello 2018-08-19 18:53:50 +02:00
parent 3b62b5ec5d
commit 1f5f429fc4
21 changed files with 551 additions and 157 deletions

View file

@ -11,14 +11,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#gen-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
Triggers.insert({activityType: "createCard","boardId":boardId,"listName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "createCard","boardId":boardId,"listName":"*"});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "removeCard","boardId":boardId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "removeCard","boardId":boardId});
}
},
'click .js-add-create-trigger'(event) {
@ -28,14 +24,10 @@ BlazeComponent.extendComponent({
const listName = this.find('#create-list-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
Triggers.insert({activityType: "createCard","boardId":boardId,"listName":listName},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "createCard","boardId":boardId,"listName":listName});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "removeCard","boardId":boardId,"listName":listName},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "removeCard","boardId":boardId,"listName":listName});
}
},
'click .js-add-moved-trigger'(event) {
@ -44,14 +36,10 @@ BlazeComponent.extendComponent({
const listName = this.find('#move-list-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "moved-to"){
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"});
}
if(actionSelected == "moved-from"){
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName});
}
},
'click .js-add-arc-trigger'(event) {
@ -59,14 +47,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#arch-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "archived"){
Triggers.insert({activityType: "archivedCard","boardId":boardId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "archivedCard","boardId":boardId});
}
if(actionSelected == "unarchived"){
Triggers.insert({activityType: "restoredCard","boardId":boardId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "restoredCard","boardId":boardId});
}
}

View file

@ -22,14 +22,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#label-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "addedLabel","boardId":boardId,"labelId":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "addedLabel","boardId":boardId,"labelId":"*"});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "removedLabel","boardId":boardId,"labelId":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "removedLabel","boardId":boardId,"labelId":"*"});
}
},
'click .js-add-spec-label-trigger'(event) {
@ -38,14 +34,10 @@ BlazeComponent.extendComponent({
const labelId = this.find('#spec-label').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "addedLabel","boardId":boardId,"labelId":labelId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "addedLabel","boardId":boardId,"labelId":labelId});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "removedLabel","boardId":boardId,"labelId":labelId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "removedLabel","boardId":boardId,"labelId":labelId});
}
},
'click .js-add-gen-member-trigger'(event) {
@ -54,14 +46,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#gen-member-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "joinMember","boardId":boardId,"memberId":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "joinMember","boardId":boardId,"memberId":"*"});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"memberId":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "unjoinMember","boardId":boardId,"memberId":"*"});
}
},
'click .js-add-spec-member-trigger'(event) {
@ -70,14 +58,10 @@ BlazeComponent.extendComponent({
const memberId = this.find('#spec-member').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "joinMember","boardId":boardId,"memberId":memberId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "joinMember","boardId":boardId,"memberId":memberId});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"memberId":memberId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "unjoinMember","boardId":boardId,"memberId":memberId});
}
},
'click .js-add-attachment-trigger'(event) {
@ -86,14 +70,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#attach-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "addAttachment","boardId":boardId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "addAttachment","boardId":boardId});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "deleteAttachment","boardId":boardId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "deleteAttachment","boardId":boardId});
}
},
}];

View file

@ -10,14 +10,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#gen-check-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "addChecklist","boardId":boardId,"checklistName":"*"});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "removeChecklist","boardId":boardId,"checklistName":"*"});
}
},
'click .js-add-spec-check-trigger'(event) {
@ -26,14 +22,10 @@ BlazeComponent.extendComponent({
const checklistId = this.find('#check-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "addChecklist","boardId":boardId,"checklistName":checklistId});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId});
}
},
'click .js-add-gen-comp-trigger'(event) {
@ -42,14 +34,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#gen-comp-check-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "completed"){
Triggers.insert({activityType: "completeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "completeChecklist","boardId":boardId,"checklistName":"*"});
}
if(actionSelected == "uncompleted"){
Triggers.insert({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*"});
}
},
'click .js-add-spec-comp-trigger'(event) {
@ -58,14 +46,10 @@ BlazeComponent.extendComponent({
const checklistId = this.find('#spec-comp-check-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "completeChecklist","boardId":boardId,"checklistName":checklistId});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":checklistId});
}
},
'click .js-add-gen-check-item-trigger'(event) {
@ -74,14 +58,10 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#check-item-gen-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "checked"){
Triggers.insert({activityType: "checkedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "checkedItem","boardId":boardId,"checklistItemName":"*"});
}
if(actionSelected == "unchecked"){
Triggers.insert({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
datas.triggerVar.set({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*"});
}
},
'click .js-add-spec-check-item-trigger'(event) {
@ -89,15 +69,11 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#check-item-spec-action').value;
const checklistItemId = this.find('#check-item-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "added"){
Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
datas.triggerIdVar.set(id);
});
if(actionSelected == "checked"){
datas.triggerVar.set({activityType: "checkedItem","boardId":boardId,"checklistItemName":checklistItemId});
}
if(actionSelected == "removed"){
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
datas.triggerIdVar.set(id);
});
if(actionSelected == "unchecked"){
datas.triggerVar.set({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":checklistItemId});
}
},
}];