summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-10-08 00:06:55 +0300
committerLauri Ojansivu <x@xet7.org>2018-10-08 00:06:55 +0300
commitd91e0358f3a3f13558f8493661aa847fdbcae528 (patch)
tree628f6bcde0a34d9156bbc7c88aaa41def3be9c85
parent4c6c6ffb164027c5a5f29d213be9858c23efd3bf (diff)
parent6931b88e4013754a7b03205a9916b9e607224f48 (diff)
downloadwekan-d91e0358f3a3f13558f8493661aa847fdbcae528.tar.gz
wekan-d91e0358f3a3f13558f8493661aa847fdbcae528.tar.bz2
wekan-d91e0358f3a3f13558f8493661aa847fdbcae528.zip
Merge branch 'feature-rules' of https://github.com/Angtrim/wekan into Angtrim-feature-rules
-rw-r--r--client/components/rules/ruleDetails.jade4
-rw-r--r--client/components/rules/ruleDetails.js8
-rw-r--r--client/components/rules/rules.styl11
-rw-r--r--client/components/rules/rulesActions.jade6
-rw-r--r--client/components/rules/rulesActions.js8
-rw-r--r--client/components/rules/rulesMain.js19
-rw-r--r--client/components/rules/rulesTriggers.jade6
-rw-r--r--client/components/rules/rulesTriggers.js6
-rw-r--r--i18n/en.i18n.json7
-rw-r--r--models/checklistItems.js8
-rw-r--r--models/wekanCreator.js6
-rw-r--r--server/rulesHelper.js17
12 files changed, 76 insertions, 30 deletions
diff --git a/client/components/rules/ruleDetails.jade b/client/components/rules/ruleDetails.jade
index b9a1351c..1f351357 100644
--- a/client/components/rules/ruleDetails.jade
+++ b/client/components/rules/ruleDetails.jade
@@ -14,5 +14,9 @@ template(name="ruleDetails")
div.trigger-content
div.trigger-text
= action
+ div.rules-back
+ button.js-goback
+ i.fa.fa-chevron-left
+ | {{{_ 'r-back'}}}
\ No newline at end of file
diff --git a/client/components/rules/ruleDetails.js b/client/components/rules/ruleDetails.js
index 386b2b48..17c86dc3 100644
--- a/client/components/rules/ruleDetails.js
+++ b/client/components/rules/ruleDetails.js
@@ -14,7 +14,9 @@ BlazeComponent.extendComponent({
const trigger = Triggers.findOne({
_id: rule.triggerId,
});
- return trigger.description();
+ const desc = trigger.description();
+ const upperdesc = desc.charAt(0).toUpperCase() + desc.substr(1);
+ return upperdesc;
},
action() {
const ruleId = this.data().ruleId;
@@ -24,7 +26,9 @@ BlazeComponent.extendComponent({
const action = Actions.findOne({
_id: rule.actionId,
});
- return action.description();
+ const desc = action.description();
+ const upperdesc = desc.charAt(0).toUpperCase() + desc.substr(1);
+ return upperdesc;
},
events() {
diff --git a/client/components/rules/rules.styl b/client/components/rules/rules.styl
index 45ce4003..b52f84a7 100644
--- a/client/components/rules/rules.styl
+++ b/client/components/rules/rules.styl
@@ -32,6 +32,17 @@
display: inline-block
float: right
margin: auto
+.rules-back
+ display: block
+ overflow: auto
+ margin-top: 15px
+ margin-bottom: 5px
+ button
+ display: inline-block
+ float: right
+ margin: auto
+ margin-right:14px
+
.flex
display: -webkit-box
display: -moz-box
diff --git a/client/components/rules/rulesActions.jade b/client/components/rules/rulesActions.jade
index 8dfceeeb..4bcff769 100644
--- a/client/components/rules/rulesActions.jade
+++ b/client/components/rules/rulesActions.jade
@@ -22,4 +22,8 @@ template(name="rulesActions")
else if ($eq currentActions.get 'checklist')
+checklistActions(ruleName=data.ruleName triggerVar=data.triggerVar)
else if ($eq currentActions.get 'mail')
- +mailActions(ruleName=data.ruleName triggerVar=data.triggerVar) \ No newline at end of file
+ +mailActions(ruleName=data.ruleName triggerVar=data.triggerVar)
+ div.rules-back
+ button.js-goback
+ i.fa.fa-chevron-left
+ | {{{_ 'r-back'}}} \ No newline at end of file
diff --git a/client/components/rules/rulesActions.js b/client/components/rules/rulesActions.js
index ecba857b..64a5c70e 100644
--- a/client/components/rules/rulesActions.js
+++ b/client/components/rules/rulesActions.js
@@ -41,16 +41,16 @@ BlazeComponent.extendComponent({
},
events() {
return [{
- 'click .js-set-board-actions' (event) {
+ 'click .js-set-board-actions'(){
this.setBoardActions();
},
- 'click .js-set-card-actions' (event) {
+ 'click .js-set-card-actions'() {
this.setCardActions();
},
- 'click .js-set-mail-actions' (event) {
+ 'click .js-set-mail-actions'() {
this.setMailActions();
},
- 'click .js-set-checklist-actions' (event) {
+ 'click .js-set-checklist-actions'() {
this.setChecklistActions();
},
}];
diff --git a/client/components/rules/rulesMain.js b/client/components/rules/rulesMain.js
index 65cc3d98..3e871c69 100644
--- a/client/components/rules/rulesMain.js
+++ b/client/components/rules/rulesMain.js
@@ -24,7 +24,7 @@ BlazeComponent.extendComponent({
events() {
return [{
- 'click .js-delete-rule' (event) {
+ 'click .js-delete-rule' () {
const rule = this.currentData();
Rules.remove(rule._id);
Actions.remove(rule.actionId);
@@ -34,9 +34,11 @@ BlazeComponent.extendComponent({
'click .js-goto-trigger' (event) {
event.preventDefault();
const ruleTitle = this.find('#ruleTitle').value;
- this.find('#ruleTitle').value = '';
- this.ruleName.set(ruleTitle);
- this.setTrigger();
+ if(ruleTitle != undefined && ruleTitle != ''){
+ this.find('#ruleTitle').value = '';
+ this.ruleName.set(ruleTitle);
+ this.setTrigger();
+ }
},
'click .js-goto-action' (event) {
event.preventDefault();
@@ -46,6 +48,15 @@ BlazeComponent.extendComponent({
event.preventDefault();
this.setRulesList();
},
+ 'click .js-goback' (event) {
+ event.preventDefault();
+ if(this.rulesCurrentTab.get() === 'trigger' || this.rulesCurrentTab.get() === 'ruleDetails' ){
+ this.setRulesList();
+ }
+ if(this.rulesCurrentTab.get() === 'action'){
+ this.setTrigger();
+ }
+ },
'click .js-goto-details' (event) {
event.preventDefault();
const rule = this.currentData();
diff --git a/client/components/rules/rulesTriggers.jade b/client/components/rules/rulesTriggers.jade
index 0ef5edfa..01c0cad5 100644
--- a/client/components/rules/rulesTriggers.jade
+++ b/client/components/rules/rulesTriggers.jade
@@ -18,4 +18,8 @@ template(name="rulesTriggers")
else if showCardTrigger.get
+cardTriggers
else if showChecklistTrigger.get
- +checklistTriggers \ No newline at end of file
+ +checklistTriggers
+ div.rules-back
+ button.js-goback
+ i.fa.fa-chevron-left
+ | {{{_ 'r-back'}}} \ No newline at end of file
diff --git a/client/components/rules/rulesTriggers.js b/client/components/rules/rulesTriggers.js
index 506e63b2..e3c16221 100644
--- a/client/components/rules/rulesTriggers.js
+++ b/client/components/rules/rulesTriggers.js
@@ -39,13 +39,13 @@ BlazeComponent.extendComponent({
},
events() {
return [{
- 'click .js-set-board-triggers' (event) {
+ 'click .js-set-board-triggers' () {
this.setBoardTriggers();
},
- 'click .js-set-card-triggers' (event) {
+ 'click .js-set-card-triggers' () {
this.setCardTriggers();
},
- 'click .js-set-checklist-triggers' (event) {
+ 'click .js-set-checklist-triggers' () {
this.setChecklistTriggers();
},
}];
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 896c10a3..cec9b6e4 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -532,7 +532,7 @@
"r-add-rule": "Add rule",
"r-view-rule": "View rule",
"r-delete-rule": "Delete rule",
- "r-new-rule-name": "Add new rule",
+ "r-new-rule-name": "New rule title",
"r-no-rules": "No rules",
"r-when-a-card-is": "When a card is",
"r-added-to": "Added to",
@@ -576,7 +576,7 @@
"r-checklist": "checklist",
"r-check-all": "Check all",
"r-uncheck-all": "Uncheck all",
- "r-item-check": "Items of checklist",
+ "r-items-check": "items of checklist",
"r-check": "Check",
"r-uncheck": "Uncheck",
"r-item": "item",
@@ -607,5 +607,6 @@
"r-d-check-of-list": "of checklist",
"r-d-add-checklist": "Add checklist",
"r-d-remove-checklist": "Remove checklist",
- "r-when-a-card-is-moved": "When a card is moved to another list"
+ "r-when-a-card-is-moved": "When a card is moved to another list",
+ "r-back": "Back"
}
diff --git a/models/checklistItems.js b/models/checklistItems.js
index 7132bc7c..519630ae 100644
--- a/models/checklistItems.js
+++ b/models/checklistItems.js
@@ -118,7 +118,7 @@ function publishCheckActivity(userId, doc){
Activities.insert(act);
}
-function publishChekListCompleted(userId, doc, fieldNames, modifier){
+function publishChekListCompleted(userId, doc, fieldNames){
const card = Cards.findOne(doc.cardId);
const boardId = card.boardId;
const checklistId = doc.checklistId;
@@ -136,7 +136,7 @@ function publishChekListCompleted(userId, doc, fieldNames, modifier){
}
}
-function publishChekListUncompleted(userId, doc, fieldNames, modifier){
+function publishChekListUncompleted(userId, doc, fieldNames){
const card = Cards.findOne(doc.cardId);
const boardId = card.boardId;
const checklistId = doc.checklistId;
@@ -162,11 +162,11 @@ if (Meteor.isServer) {
ChecklistItems.after.update((userId, doc, fieldNames, modifier) => {
publishCheckActivity(userId, doc);
- publishChekListCompleted(userId, doc, fieldNames, modifier);
+ publishChekListCompleted(userId, doc, fieldNames);
});
ChecklistItems.before.update((userId, doc, fieldNames, modifier) => {
- publishChekListUncompleted(userId, doc, fieldNames, modifier);
+ publishChekListUncompleted(userId, doc, fieldNames);
});
diff --git a/models/wekanCreator.js b/models/wekanCreator.js
index b018b06d..59d0cfd5 100644
--- a/models/wekanCreator.js
+++ b/models/wekanCreator.js
@@ -510,7 +510,7 @@ export class WekanCreator {
}
createTriggers(wekanTriggers, boardId) {
- wekanTriggers.forEach((trigger, ruleIndex) => {
+ wekanTriggers.forEach((trigger) => {
if (trigger.hasOwnProperty('labelId')) {
trigger.labelId = this.labels[trigger.labelId];
}
@@ -525,7 +525,7 @@ export class WekanCreator {
}
createActions(wekanActions, boardId) {
- wekanActions.forEach((action, ruleIndex) => {
+ wekanActions.forEach((action) => {
if (action.hasOwnProperty('labelId')) {
action.labelId = this.labels[action.labelId];
}
@@ -540,7 +540,7 @@ export class WekanCreator {
}
createRules(wekanRules, boardId) {
- wekanRules.forEach((rule, ruleIndex) => {
+ wekanRules.forEach((rule) => {
// Create the rule
rule.boardId = boardId;
rule.triggerId = this.triggers[rule.triggerId];
diff --git a/server/rulesHelper.js b/server/rulesHelper.js
index e9139933..3630507a 100644
--- a/server/rulesHelper.js
+++ b/server/rulesHelper.js
@@ -3,7 +3,9 @@ RulesHelper = {
const matchingRules = this.findMatchingRules(activity);
for(let i = 0; i< matchingRules.length; i++){
const action = matchingRules[i].getAction();
- this.performAction(activity, action);
+ if(action != undefined){
+ this.performAction(activity, action);
+ }
}
},
findMatchingRules(activity){
@@ -16,7 +18,12 @@ RulesHelper = {
const matchingTriggers = Triggers.find(matchingMap);
const matchingRules = [];
matchingTriggers.forEach(function(trigger){
- matchingRules.push(trigger.getRule());
+ const rule = trigger.getRule();
+ // Check that for some unknown reason there are some leftover triggers
+ // not connected to any rules
+ if(rule != undefined){
+ matchingRules.push(trigger.getRule());
+ }
});
return matchingRules;
},
@@ -65,10 +72,10 @@ RulesHelper = {
const emailSubject = action.emailSubject;
try {
Email.send({
- to,
+ emailTo,
from: Accounts.emailTemplates.from,
- subject,
- text,
+ emailSubject,
+ emailMsg,
});
} catch (e) {
return;