mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
Merge branch 'feature-rules' of https://github.com/Angtrim/wekan into Angtrim-feature-rules
This commit is contained in:
commit
d91e0358f3
12 changed files with 76 additions and 30 deletions
|
@ -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'}}}
|
||||
|
||||
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
+mailActions(ruleName=data.ruleName triggerVar=data.triggerVar)
|
||||
div.rules-back
|
||||
button.js-goback
|
||||
i.fa.fa-chevron-left
|
||||
| {{{_ 'r-back'}}}
|
|
@ -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();
|
||||
},
|
||||
}];
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -18,4 +18,8 @@ template(name="rulesTriggers")
|
|||
else if showCardTrigger.get
|
||||
+cardTriggers
|
||||
else if showChecklistTrigger.get
|
||||
+checklistTriggers
|
||||
+checklistTriggers
|
||||
div.rules-back
|
||||
button.js-goback
|
||||
i.fa.fa-chevron-left
|
||||
| {{{_ 'r-back'}}}
|
|
@ -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();
|
||||
},
|
||||
}];
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue