diff options
author | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-09-14 17:35:14 +0200 |
---|---|---|
committer | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-09-14 17:35:14 +0200 |
commit | 30a3daa6af179009ac17b40a71bf3f9e9b1d698a (patch) | |
tree | 16e2ecdc589aa67367f3d53a44c1eaba8ba1f637 /client | |
parent | fc73dc5bbcbbd203efc4f10ecb4bd1a66e0d9efb (diff) | |
download | wekan-30a3daa6af179009ac17b40a71bf3f9e9b1d698a.tar.gz wekan-30a3daa6af179009ac17b40a71bf3f9e9b1d698a.tar.bz2 wekan-30a3daa6af179009ac17b40a71bf3f9e9b1d698a.zip |
Finished alpha rules
Diffstat (limited to 'client')
-rw-r--r-- | client/components/rules/actions/boardActions.js | 16 | ||||
-rw-r--r-- | client/components/rules/actions/cardActions.js | 58 | ||||
-rw-r--r-- | client/components/rules/actions/checklistActions.js | 16 | ||||
-rw-r--r-- | client/components/rules/actions/mailActions.js | 3 | ||||
-rw-r--r-- | client/components/rules/ruleDetails.jade | 15 | ||||
-rw-r--r-- | client/components/rules/triggers/cardTriggers.js | 184 | ||||
-rw-r--r-- | client/components/rules/triggers/checklistTriggers.js | 36 | ||||
-rw-r--r-- | client/lib/utils.js | 6 |
8 files changed, 201 insertions, 133 deletions
diff --git a/client/components/rules/actions/boardActions.js b/client/components/rules/actions/boardActions.js index d1593a5b..0394f601 100644 --- a/client/components/rules/actions/boardActions.js +++ b/client/components/rules/actions/boardActions.js @@ -13,47 +13,49 @@ BlazeComponent.extendComponent({ const actionSelected = this.find('#move-spec-action').value; const listTitle = this.find('#listName').value; const boardId = Session.get('currentBoard'); - + const desc = Utils.getTriggerActionDesc(event,this); if(actionSelected == "top"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "moveCardToTop","listTitle":listTitle,"boardId":boardId}); + const actionId = Actions.insert({actionType: "moveCardToTop","listTitle":listTitle,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "bottom"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "moveCardToBottom","listTitle":listTitle,"boardId":boardId}); + const actionId = Actions.insert({actionType: "moveCardToBottom","listTitle":listTitle,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } }, 'click .js-add-gen-move-action'(event) { + const desc = Utils.getTriggerActionDesc(event,this); const boardId = Session.get('currentBoard'); const ruleName = this.data().ruleName.get(); const trigger = this.data().triggerVar.get(); const actionSelected = this.find('#move-gen-action').value; if(actionSelected == "top"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "moveCardToTop","listTitle":"*","boardId":boardId}); + const actionId = Actions.insert({actionType: "moveCardToTop","listTitle":"*","boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "bottom"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "moveCardToBottom","listTitle":"*","boardId":boardId}); + const actionId = Actions.insert({actionType: "moveCardToBottom","listTitle":"*","boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } }, 'click .js-add-arch-action'(event) { + const desc = Utils.getTriggerActionDesc(event,this); const boardId = Session.get('currentBoard'); const ruleName = this.data().ruleName.get(); const trigger = this.data().triggerVar.get(); const actionSelected = this.find('#arch-action').value; if(actionSelected == "archive"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "archive","boardId":boardId}); + const actionId = Actions.insert({actionType: "archive","boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "unarchive"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "unarchive","boardId":boardId}); + const actionId = Actions.insert({actionType: "unarchive","boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } }, diff --git a/client/components/rules/actions/cardActions.js b/client/components/rules/actions/cardActions.js index 3f4b4442..0bf7428a 100644 --- a/client/components/rules/actions/cardActions.js +++ b/client/components/rules/actions/cardActions.js @@ -24,45 +24,47 @@ BlazeComponent.extendComponent({ const actionSelected = this.find('#label-action').value; const labelId = this.find('#label-id').value; const boardId = Session.get('currentBoard'); - + const desc = Utils.getTriggerActionDesc(event,this); if(actionSelected == "add"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "addLabel","labelId":labelId,"boardId":boardId}); + const actionId = Actions.insert({actionType: "addLabel","labelId":labelId,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "remove"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "removeLabel","labelId":labelId,"boardId":boardId}); + const actionId = Actions.insert({actionType: "removeLabel","labelId":labelId,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } }, 'click .js-add-member-action'(event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const actionSelected = this.find('#member-action').value; - const memberName = this.find('#member-name').value; - const boardId = Session.get('currentBoard'); - if(actionSelected == "add"){ - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "addMember","memberName":memberName,"boardId":boardId}); - Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); - } - if(actionSelected == "remove"){ - const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "removeMember","memberName":memberName,"boardId":boardId}); - Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); - } - }, - 'click .js-add-removeall-action'(event) { - const ruleName = this.data().ruleName.get(); - const trigger = this.data().triggerVar.get(); - const triggerId = Triggers.insert(trigger); - const boardId = Session.get('currentBoard'); - const actionId = Actions.insert({actionType: "removeMember","memberName":"*","boardId":boardId}); - Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); - }, - }]; + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const actionSelected = this.find('#member-action').value; + const memberName = this.find('#member-name').value; + const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event,this); + if(actionSelected == "add"){ + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({actionType: "addMember","memberName":memberName,"boardId":boardId,"desc":desc}); + Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId,"desc":desc}); + } + if(actionSelected == "remove"){ + const triggerId = Triggers.insert(trigger); + const actionId = Actions.insert({actionType: "removeMember","memberName":memberName,"boardId":boardId,"desc":desc}); + Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); + } + }, + 'click .js-add-removeall-action'(event) { + const ruleName = this.data().ruleName.get(); + const trigger = this.data().triggerVar.get(); + const triggerId = Triggers.insert(trigger); + const desc = Utils.getTriggerActionDesc(event,this); + const boardId = Session.get('currentBoard'); + const actionId = Actions.insert({actionType: "removeMember","memberName":"*","boardId":boardId,"desc":desc}); + Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); +}, +}]; }, }).register('cardActions');
\ No newline at end of file diff --git a/client/components/rules/actions/checklistActions.js b/client/components/rules/actions/checklistActions.js index e6989fc6..bfc07623 100644 --- a/client/components/rules/actions/checklistActions.js +++ b/client/components/rules/actions/checklistActions.js @@ -10,15 +10,15 @@ BlazeComponent.extendComponent({ const actionSelected = this.find('#check-action').value; const checklistName = this.find('#checklist-name').value; const boardId = Session.get('currentBoard'); - +const desc = Utils.getTriggerActionDesc(event,this); if(actionSelected == "add"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "addChecklist","checklistName":checklistName,"boardId":boardId}); + const actionId = Actions.insert({actionType: "addChecklist","checklistName":checklistName,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "remove"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "removeChecklist","checklistName":checklistName,"boardId":boardId}); + const actionId = Actions.insert({actionType: "removeChecklist","checklistName":checklistName,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } @@ -29,14 +29,15 @@ BlazeComponent.extendComponent({ const actionSelected = this.find('#checkall-action').value; const checklistName = this.find('#checklist-name2').value; const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event,this); if(actionSelected == "check"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "checkAll","checklistName":checklistName,"boardId":boardId}); + const actionId = Actions.insert({actionType: "checkAll","checklistName":checklistName,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "uncheck"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "uncheckAll","checklistName":checklistName,"boardId":boardId}); + const actionId = Actions.insert({actionType: "uncheckAll","checklistName":checklistName,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } }, @@ -47,14 +48,15 @@ BlazeComponent.extendComponent({ const checklistName = this.find("#checklist-name3"); const actionSelected = this.find('#check-item-action').value; const boardId = Session.get('currentBoard'); + const desc = Utils.getTriggerActionDesc(event,this); if(actionSelected == "check"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "checkItem","checklistName":checklistName,"checkItemName":checkItemName,"boardId":boardId}); + const actionId = Actions.insert({actionType: "checkItem","checklistName":checklistName,"checkItemName":checkItemName,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } if(actionSelected == "uncheck"){ const triggerId = Triggers.insert(trigger); - const actionId = Actions.insert({actionType: "uncheckItem","checklistName":checklistName,"checkItemName":checkItemName,"boardId":boardId}); + const actionId = Actions.insert({actionType: "uncheckItem","checklistName":checklistName,"checkItemName":checkItemName,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); } }, diff --git a/client/components/rules/actions/mailActions.js b/client/components/rules/actions/mailActions.js index 74f6659b..65b8a2d8 100644 --- a/client/components/rules/actions/mailActions.js +++ b/client/components/rules/actions/mailActions.js @@ -13,7 +13,8 @@ BlazeComponent.extendComponent({ const ruleName = this.data().ruleName.get(); const triggerId = Triggers.insert(trigger); const boardId = Session.get('currentBoard'); - const actionId = Actions.insert({actionType: "sendEmail","emailTo":emailTo,"emailSubject":emailSubject,"emailMsg":emailMsg,"boardId":boardId}); + const desc = Utils.getTriggerActionDesc(event,this); + const actionId = Actions.insert({actionType: "sendEmail","emailTo":emailTo,"emailSubject":emailSubject,"emailMsg":emailMsg,"boardId":boardId,"desc":desc}); Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId}); }, }]; diff --git a/client/components/rules/ruleDetails.jade b/client/components/rules/ruleDetails.jade index 479553d1..b9a1351c 100644 --- a/client/components/rules/ruleDetails.jade +++ b/client/components/rules/ruleDetails.jade @@ -3,5 +3,16 @@ template(name="ruleDetails") h2 i.fa.fa-magic | {{{_ 'r-rule-details' }}} - = trigger - = action
\ No newline at end of file + .triggers-content + .triggers-body + .triggers-main-body + div.trigger-item + div.trigger-content + div.trigger-text + = trigger + div.trigger-item + div.trigger-content + div.trigger-text + = action + +
\ No newline at end of file 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'); diff --git a/client/lib/utils.js b/client/lib/utils.js index 1b5ad1f3..e6dc7d85 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -152,9 +152,9 @@ Utils = { for(let i = 0;i< triggerEls.length;i++){ const element = tempInstance.$(triggerEls[i]); if(element.hasClass("trigger-text")){ - finalString += element.text(); + finalString += element.text().toLowerCase(); }else if(element.find("select").length > 0){ - finalString += element.find("select option:selected").text(); + finalString += element.find("select option:selected").text().toLowerCase(); }else if(element.find("input").length > 0){ finalString += element.find("input").val(); } @@ -163,7 +163,7 @@ Utils = { finalString += " "; } } - return finalString.toLowerCase(); + return finalString; }, }; |