diff options
Diffstat (limited to 'client/components/rules')
-rw-r--r-- | client/components/rules/rulesActions.jade | 2 | ||||
-rw-r--r-- | client/components/rules/triggers/cardTriggers.jade | 32 | ||||
-rw-r--r-- | client/components/rules/triggers/cardTriggers.js | 83 |
3 files changed, 58 insertions, 59 deletions
diff --git a/client/components/rules/rulesActions.jade b/client/components/rules/rulesActions.jade index 0e207495..35b070fc 100644 --- a/client/components/rules/rulesActions.jade +++ b/client/components/rules/rulesActions.jade @@ -1,7 +1,7 @@ template(name="rulesActions") h2 i.fa.fa-cutlery - | Rule "#{data.ruleName}" - Add action + | Rule "#{data.ruleName.get}" - Add action .triggers-content .triggers-body .triggers-side-menu diff --git a/client/components/rules/triggers/cardTriggers.jade b/client/components/rules/triggers/cardTriggers.jade index 473ceb57..9675324f 100644 --- a/client/components/rules/triggers/cardTriggers.jade +++ b/client/components/rules/triggers/cardTriggers.jade @@ -4,8 +4,8 @@ template(name="cardTriggers") div.trigger-text | When a label is div.trigger-dropdown - select(id="create-action") - option(value="created") Added to + select(id="label-action") + option(value="added") Added to option(value="removed") Removed from div.trigger-text | a card @@ -17,19 +17,19 @@ template(name="cardTriggers") div.trigger-text | When the label div.trigger-dropdown - select(id="label") + select(id="spec-label") each labels - option + option(value="#{_id}") = name div.trigger-text | is div.trigger-dropdown - select(id="create-action") - option(value="created") Added to + select(id="spec-label-action") + option(value="added") Added to option(value="removed") Removed from div.trigger-text | a card - div.trigger-button.js-add-label-trigger.js-goto-action + div.trigger-button.js-add-spec-label-trigger.js-goto-action i.fa.fa-plus div.trigger-item @@ -37,12 +37,12 @@ template(name="cardTriggers") div.trigger-text | When a member is div.trigger-dropdown - select(id="create-action") - option(value="created") Added to + select(id="gen-member-action") + option(value="added") 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-member-trigger.js-goto-action i.fa.fa-plus @@ -51,16 +51,16 @@ template(name="cardTriggers") div.trigger-text | When the member div.trigger-dropdown - input(id="create-list-name",type=text,placeholder="name") + input(id="spec-member",type=text,placeholder="name") div.trigger-text | is div.trigger-dropdown - select(id="create-action") - option(value="created") Added to + select(id="spec-member-action") + option(value="added") Added to option(value="removed") Removed from div.trigger-text | a card - div.trigger-button.js-add-member-trigger.js-goto-action + div.trigger-button.js-add-spec-member-trigger.js-goto-action i.fa.fa-plus div.trigger-item @@ -70,8 +70,8 @@ template(name="cardTriggers") div.trigger-text | is div.trigger-dropdown - select(id="create-action") - option(value="created") Added to + select(id="attach-action") + option(value="added") Added to option(value="removed") Removed from div.trigger-text | a card diff --git a/client/components/rules/triggers/cardTriggers.js b/client/components/rules/triggers/cardTriggers.js index 2529641e..a9940e07 100644 --- a/client/components/rules/triggers/cardTriggers.js +++ b/client/components/rules/triggers/cardTriggers.js @@ -16,87 +16,86 @@ BlazeComponent.extendComponent({ }, events() { return [ - {'click .js-add-gen-trigger'(event) { + {'click .js-add-gen-label-trigger'(event) { let datas = this.data(); - const actionSelected = this.find('#gen-action').value; + const actionSelected = this.find('#label-action').value; const boardId = Session.get('currentBoard') - if(actionSelected == "created"){ - Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){ + if(actionSelected == "added"){ + Triggers.insert({activityType: "addedLabel","boardId":boardId,"labelId":"*"},function(error,id){ datas.triggerIdVar.set(id); }); } if(actionSelected == "removed"){ - Triggers.insert({activityType: "removeCard","boardId":boardId},function(error,id){ + Triggers.insert({activityType: "removedLabel","boardId":boardId,"labelId":"*"},function(error,id){ datas.triggerIdVar.set(id); }); } }, - 'click .js-add-create-trigger'(event) { - + 'click .js-add-spec-label-trigger'(event) { let datas = this.data(); - const actionSelected = this.find('#create-action').value; - const listName = this.find('#create-list-name').value; + const actionSelected = this.find('#spec-label-action').value; + const labelId = this.find('#spec-label').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){ + if(actionSelected == "added"){ + Triggers.insert({activityType: "addedLabel","boardId":boardId,"labelId":labelId},function(error,id){ datas.triggerIdVar.set(id); }); } if(actionSelected == "removed"){ - Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){ + Triggers.insert({activityType: "removedLabel","boardId":boardId,"labelId":labelId},function(error,id){ datas.triggerIdVar.set(id); }); } }, - 'click .js-add-moved-trigger'(event) { + 'click .js-add-gen-member-trigger'(event) { + let datas = this.data(); - const actionSelected = this.find('#move-action').value; - const listName = this.find('#move-list-name').value; + const actionSelected = this.find('#gen-member-action').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){ + if(actionSelected == "added"){ + Triggers.insert({activityType: "joinMember","boardId":boardId,"memberId":"*"},function(error,id){ datas.triggerIdVar.set(id); }); } - if(actionSelected == "moved-from"){ - Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){ + if(actionSelected == "removed"){ + Triggers.insert({activityType: "unjoinMember","boardId":boardId,"memberId":"*"},function(error,id){ datas.triggerIdVar.set(id); }); } }, - 'click .js-add-arc-trigger'(event) { + 'click .js-add-spec-member-trigger'(event) { let datas = this.data(); - const actionSelected = this.find('#arch-action').value; + const actionSelected = this.find('#spec-member-action').value; + const memberId = this.find('#spec-member').value; const boardId = Session.get('currentBoard') - if(actionSelected == "archived"){ - Triggers.insert({activityType: "archivedCard","boardId":boardId},function(error,id){ + if(actionSelected == "added"){ + Triggers.insert({activityType: "joinMember","boardId":boardId,"memberId":memberId},function(error,id){ datas.triggerIdVar.set(id); }); } - if(actionSelected == "unarchived"){ - Triggers.insert({activityType: "restoredCard","boardId":boardId},function(error,id){ + if(actionSelected == "removed"){ + Triggers.insert({activityType: "unjoinMember","boardId":boardId,"memberId":memberId},function(error,id){ datas.triggerIdVar.set(id); }); } - } + }, + '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"){ + Triggers.insert({activityType: "addAttachment","boardId":boardId},function(error,id){ + datas.triggerIdVar.set(id); + }); + } + if(actionSelected == "removed"){ + Triggers.insert({activityType: "deleteAttachment","boardId":boardId},function(error,id){ + datas.triggerIdVar.set(id); + }); + } + }, }]; }, |