summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/rules/triggers/boardTriggers.js26
-rw-r--r--client/components/rules/triggers/checklistTriggers.jade46
-rw-r--r--client/components/rules/triggers/checklistTriggers.js108
-rw-r--r--models/cards.js4
-rw-r--r--models/checklistItems.js5
-rw-r--r--models/checklists.js2
-rw-r--r--server/triggersDef.js20
7 files changed, 157 insertions, 54 deletions
diff --git a/client/components/rules/triggers/boardTriggers.js b/client/components/rules/triggers/boardTriggers.js
index 6ec1ec4e..49c00c16 100644
--- a/client/components/rules/triggers/boardTriggers.js
+++ b/client/components/rules/triggers/boardTriggers.js
@@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#gen-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
- Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
+ Triggers.insert({activityType: "createCard","boardId":boardId,"listName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
}
@@ -27,20 +27,13 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#create-action').value;
const listName = this.find('#create-list-name').value;
const boardId = Session.get('currentBoard')
- const list = Lists.findOne({title:listName});
- let listId;
- if(list == undefined){
- listId = "*"
- }else{
- listId = list._id;
- }
if(actionSelected == "created"){
- Triggers.insert({activityType: "createCard","boardId":boardId,"listId":listId},function(error,id){
+ Triggers.insert({activityType: "createCard","boardId":boardId,"listName":listName},function(error,id){
datas.triggerIdVar.set(id);
});
}
if(actionSelected == "removed"){
- Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){
+ Triggers.insert({activityType: "removeCard","boardId":boardId,"listName":listName},function(error,id){
datas.triggerIdVar.set(id);
});
}
@@ -50,22 +43,13 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#move-action').value;
const listName = this.find('#move-list-name').value;
const boardId = Session.get('currentBoard')
- const list = Lists.findOne({title:listName});
- console.log(list);
- let listId;
- if(list == undefined){
- listId = "*"
- }else{
- listId = list._id;
- }
- console.log(listId);
if(actionSelected == "moved-to"){
- Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":listId,"oldListId":"*"},function(error,id){
+ Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"},function(error,id){
datas.triggerIdVar.set(id);
});
}
if(actionSelected == "moved-from"){
- Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){
+ Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName},function(error,id){
datas.triggerIdVar.set(id);
});
}
diff --git a/client/components/rules/triggers/checklistTriggers.jade b/client/components/rules/triggers/checklistTriggers.jade
index a34d89d0..e7d6d34e 100644
--- a/client/components/rules/triggers/checklistTriggers.jade
+++ b/client/components/rules/triggers/checklistTriggers.jade
@@ -4,12 +4,12 @@ template(name="checklistTriggers")
div.trigger-text
| When a checklist is
div.trigger-dropdown
- select(id="create-action")
+ select(id="gen-check-action")
option(value="created") Added to
option(value="removed") Removed from
div.trigger-text
| a card
- div.trigger-button.js-add-gen.member-trigger.js-goto-action
+ div.trigger-button.js-add-gen-check-trigger.js-goto-action
i.fa.fa-plus
@@ -18,16 +18,16 @@ template(name="checklistTriggers")
div.trigger-text
| When the checklist
div.trigger-dropdown
- input(id="create-list-name",type=text,placeholder="Name")
+ input(id="check-name",type=text,placeholder="Name")
div.trigger-text
| is
div.trigger-dropdown
- select(id="create-action")
+ select(id="spec-check-action")
option(value="created") Added to
option(value="removed") Removed from
div.trigger-text
| a card
- div.trigger-button.js-add-checklist-trigger.js-goto-action
+ div.trigger-button.js-add-spec-check-trigger.js-goto-action
i.fa.fa-plus
div.trigger-item
@@ -35,10 +35,10 @@ template(name="checklistTriggers")
div.trigger-text
| When a checklist is
div.trigger-dropdown
- select(id="create-action")
- option(value="created") Completed
- option(value="removed") Made incomplete
- div.trigger-button.js-add-gen.member-trigger.js-goto-action
+ select(id="gen-comp-check-action")
+ option(value="completed") Completed
+ option(value="uncompleted") Made incomplete
+ div.trigger-button.js-add-gen-comp-trigger.js-goto-action
i.fa.fa-plus
div.trigger-item
@@ -46,14 +46,14 @@ template(name="checklistTriggers")
div.trigger-text
| When the checklist
div.trigger-dropdown
- input(id="create-list-name",type=text,placeholder="Name")
+ input(id="spec-comp-check-name",type=text,placeholder="Name")
div.trigger-text
| is
div.trigger-dropdown
- select(id="create-action")
- option(value="created") Completed
- option(value="removed") Made incomplete
- div.trigger-button.js-add-checklist-trigger.js-goto-action
+ select(id="spec-comp-check-action")
+ option(value="completed") Completed
+ option(value="uncompleted") Made incomplete
+ div.trigger-button.js-add-spec-comp-trigger.js-goto-action
i.fa.fa-plus
div.trigger-item
@@ -61,10 +61,10 @@ template(name="checklistTriggers")
div.trigger-text
| When a checklist item is
div.trigger-dropdown
- select(id="create-action")
- option(value="created") Checked
- option(value="removed") Unchecked
- div.trigger-button.js-add-gen.member-trigger.js-goto-action
+ select(id="check-item-gen-action")
+ option(value="checked") Checked
+ option(value="unchecked") Unchecked
+ div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
i.fa.fa-plus
div.trigger-item
@@ -72,12 +72,12 @@ template(name="checklistTriggers")
div.trigger-text
| When the checklist item
div.trigger-dropdown
- input(id="create-list-name",type=text,placeholder="Name")
+ input(id="check-item-name",type=text,placeholder="Name")
div.trigger-text
| is
div.trigger-dropdown
- select(id="create-action")
- option(value="created") Checked
- option(value="removed") Unchecked
- div.trigger-button.js-add-checklist-trigger.js-goto-action
+ select(id="check-item-spec-action")
+ option(value="checked") Checked
+ option(value="unchecked") Unchecked
+ div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
i.fa.fa-plus \ No newline at end of file
diff --git a/client/components/rules/triggers/checklistTriggers.js b/client/components/rules/triggers/checklistTriggers.js
new file mode 100644
index 00000000..9880e3bb
--- /dev/null
+++ b/client/components/rules/triggers/checklistTriggers.js
@@ -0,0 +1,108 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.subscribe('allRules');
+ },
+ events() {
+ return [
+ {'click .js-add-gen-check-trigger'(event) {
+
+ let datas = this.data();
+ 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);
+ });
+ }
+ if(actionSelected == "removed"){
+ Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ },
+ 'click .js-add-spec-check-trigger'(event) {
+ 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"){
+ Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ if(actionSelected == "removed"){
+ Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ },
+ 'click .js-add-gen-comp-trigger'(event) {
+
+ let datas = this.data();
+ 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);
+ });
+ }
+ if(actionSelected == "uncompleted"){
+ Triggers.insert({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ },
+ 'click .js-add-spec-comp-trigger'(event) {
+ 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"){
+ Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ if(actionSelected == "removed"){
+ Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ },
+ 'click .js-add-gen-check-item-trigger'(event) {
+
+ let datas = this.data();
+ 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);
+ });
+ }
+ if(actionSelected == "unchecked"){
+ Triggers.insert({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ },
+ 'click .js-add-spec-check-item-trigger'(event) {
+ 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 == "added"){
+ Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ if(actionSelected == "removed"){
+ Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
+ datas.triggerIdVar.set(id);
+ });
+ }
+ },
+ }];
+ },
+
+}).register('checklistTriggers');
+
+
diff --git a/models/cards.js b/models/cards.js
index 364f5a39..c5aceeb7 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -561,6 +561,7 @@ function cardMove(userId, doc, fieldNames, oldListId) {
userId,
oldListId,
activityType: 'moveCard',
+ listName: doc.title,
listId: doc.listId,
boardId: doc.boardId,
cardId: doc._id,
@@ -574,6 +575,7 @@ function cardState(userId, doc, fieldNames) {
Activities.insert({
userId,
activityType: 'archivedCard',
+ listName: doc.title,
boardId: doc.boardId,
listId: doc.listId,
cardId: doc._id,
@@ -583,6 +585,7 @@ function cardState(userId, doc, fieldNames) {
userId,
activityType: 'restoredCard',
boardId: doc.boardId,
+ listName: doc.title,
listId: doc.listId,
cardId: doc._id,
});
@@ -664,6 +667,7 @@ function cardCreation(userId, doc) {
userId,
activityType: 'createCard',
boardId: doc.boardId,
+ listName: doc.title,
listId: doc.listId,
cardId: doc._id,
});
diff --git a/models/checklistItems.js b/models/checklistItems.js
index 1378e0f5..669003bb 100644
--- a/models/checklistItems.js
+++ b/models/checklistItems.js
@@ -70,6 +70,7 @@ function itemCreation(userId, doc) {
boardId,
checklistId: doc.checklistId,
checklistItemId: doc._id,
+ checklistItemName:doc.title
});
}
@@ -83,6 +84,7 @@ function itemRemover(userId, doc) {
boardId,
checklistId: doc.checklistId,
checklistItemId: doc._id,
+ checklistItemName:doc.title
});
Activities.remove({
checklistItemId: doc._id,
@@ -105,6 +107,7 @@ function publishCheckActivity(userId,doc){
boardId,
checklistId: doc.checklistId,
checklistItemId: doc._id,
+ checklistItemName:doc.title
}
console.log(act);
Activities.insert(act);
@@ -122,6 +125,7 @@ function publishChekListCompleted(userId,doc,fieldNames,modifier){
cardId: doc.cardId,
boardId,
checklistId: doc.checklistId,
+ checklistName:doc.title
}
Activities.insert(act);
}
@@ -139,6 +143,7 @@ function publishChekListUncompleted(userId,doc,fieldNames,modifier){
cardId: doc.cardId,
boardId,
checklistId: doc.checklistId,
+ checklistName:doc.title
}
Activities.insert(act);
}
diff --git a/models/checklists.js b/models/checklists.js
index 3f07c858..4a43818c 100644
--- a/models/checklists.js
+++ b/models/checklists.js
@@ -91,6 +91,7 @@ if (Meteor.isServer) {
cardId: doc.cardId,
boardId: Cards.findOne(doc.cardId).boardId,
checklistId: doc._id,
+ checklistName:doc.title
});
});
@@ -107,6 +108,7 @@ if (Meteor.isServer) {
cardId: doc.cardId,
boardId: Cards.findOne(doc.cardId).boardId,
checklistId: doc._id,
+ checklistName:doc.title
});
diff --git a/server/triggersDef.js b/server/triggersDef.js
index fce7ff69..8c52051b 100644
--- a/server/triggersDef.js
+++ b/server/triggersDef.js
@@ -1,9 +1,9 @@
TriggersDef = {
createCard:{
- matchingFields: ["boardId", "listId"]
+ matchingFields: ["boardId", "listName"]
},
moveCard:{
- matchingFields: ["boardId", "listId", "oldListId"]
+ matchingFields: ["boardId", "listName", "oldListName"]
},
archivedCard:{
matchingFields: ["boardId"]
@@ -18,28 +18,28 @@ TriggersDef = {
matchingFields: ["boardId","memberId"]
},
addChecklist:{
- matchingFields: ["boardId","checklistId"]
+ matchingFields: ["boardId","checklistName"]
},
removeChecklist:{
- matchingFields: ["boardId","checklistId"]
+ matchingFields: ["boardId","checklistName"]
},
completeChecklist:{
- matchingFields: ["boardId","checklistId"]
+ matchingFields: ["boardId","checklistName"]
},
uncompleteChecklist:{
- matchingFields: ["boardId","checklistId"]
+ matchingFields: ["boardId","checklistName"]
},
addedChecklistItem:{
- matchingFields: ["boardId","checklistItemId"]
+ matchingFields: ["boardId","checklistItemName"]
},
removedChecklistItem:{
- matchingFields: ["boardId","checklistItemId"]
+ matchingFields: ["boardId","checklistItemName"]
},
checkedItem:{
- matchingFields: ["boardId","checklistItemId"]
+ matchingFields: ["boardId","checklistItemName"]
},
uncheckedItem:{
- matchingFields: ["boardId","checklistItemId"]
+ matchingFields: ["boardId","checklistItemName"]
},
addAttachment:{
matchingFields: ["boardId"]