summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/components/rules/actions/boardActions.js5
-rw-r--r--client/components/rules/actions/cardActions.js1
-rw-r--r--client/components/rules/ruleDetails.jade5
-rw-r--r--client/components/rules/ruleDetails.js17
-rw-r--r--client/components/rules/rulesList.jade2
-rw-r--r--client/components/rules/rulesMain.jade4
-rw-r--r--client/components/rules/rulesMain.js2
-rw-r--r--client/components/rules/triggers/boardTriggers.jade4
-rw-r--r--client/components/rules/triggers/boardTriggers.js25
-rw-r--r--client/components/rules/triggers/cardTriggers.jade2
-rw-r--r--client/lib/utils.js51
11 files changed, 77 insertions, 41 deletions
diff --git a/client/components/rules/actions/boardActions.js b/client/components/rules/actions/boardActions.js
index 2b6fed57..d1593a5b 100644
--- a/client/components/rules/actions/boardActions.js
+++ b/client/components/rules/actions/boardActions.js
@@ -17,7 +17,6 @@ BlazeComponent.extendComponent({
if(actionSelected == "top"){
const triggerId = Triggers.insert(trigger);
const actionId = Actions.insert({actionType: "moveCardToTop","listTitle":listTitle,"boardId":boardId});
- console.log("Action inserted");
Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId});
}
if(actionSelected == "bottom"){
@@ -49,12 +48,12 @@ BlazeComponent.extendComponent({
const actionSelected = this.find('#arch-action').value;
if(actionSelected == "archive"){
const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({actionType: "archive"});
+ const actionId = Actions.insert({actionType: "archive","boardId":boardId});
Rules.insert({title: ruleName, triggerId: triggerId, actionId: actionId,"boardId":boardId});
}
if(actionSelected == "unarchive"){
const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({actionType: "unarchive"});
+ const actionId = Actions.insert({actionType: "unarchive","boardId":boardId});
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 571020a8..3f4b4442 100644
--- a/client/components/rules/actions/cardActions.js
+++ b/client/components/rules/actions/cardActions.js
@@ -5,7 +5,6 @@ BlazeComponent.extendComponent({
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){
labels[i].name = labels[i].color.toUpperCase();
diff --git a/client/components/rules/ruleDetails.jade b/client/components/rules/ruleDetails.jade
index 9314151d..479553d1 100644
--- a/client/components/rules/ruleDetails.jade
+++ b/client/components/rules/ruleDetails.jade
@@ -3,6 +3,5 @@ template(name="ruleDetails")
h2
i.fa.fa-magic
| {{{_ 'r-rule-details' }}}
-
- | trigger
- | action \ No newline at end of file
+ = trigger
+ = action \ No newline at end of file
diff --git a/client/components/rules/ruleDetails.js b/client/components/rules/ruleDetails.js
index 572978ac..872fec2d 100644
--- a/client/components/rules/ruleDetails.js
+++ b/client/components/rules/ruleDetails.js
@@ -1,15 +1,24 @@
BlazeComponent.extendComponent({
onCreated() {
this.subscribe('allRules');
+ this.subscribe('allTriggers');
+ this.subscribe('allActions');
+
},
trigger(){
- const rule = Rules.findOne({_id:ruleId});
- return Triggers.findOne({_id:rule.triggerId});
+ const ruleId = this.data().ruleId;
+ const rule = Rules.findOne({_id: ruleId.get()});
+ const trigger = Triggers.findOne({_id:rule.triggerId});
+ console.log(trigger);
+ return trigger.description();
},
action(){
- const rule = Rules.findOne({_id:ruleId});
- return Triggers.findOne({_id:rule.actionId});
+ const ruleId = this.data().ruleId;
+ const rule = Rules.findOne({_id: ruleId.get()});
+ const action = Actions.findOne({_id:rule.actionId});
+ console.log(action);
+ return action.description();
},
events() {
diff --git a/client/components/rules/rulesList.jade b/client/components/rules/rulesList.jade
index 7f9e6946..c2676aa7 100644
--- a/client/components/rules/rulesList.jade
+++ b/client/components/rules/rulesList.jade
@@ -10,7 +10,7 @@ template(name="rulesList")
p
= title
div.rules-btns-group
- button
+ button.js-goto-details
i.fa.fa-eye
| {{{_ 'r-view-rule'}}}
if currentUser.isAdmin
diff --git a/client/components/rules/rulesMain.jade b/client/components/rules/rulesMain.jade
index 3d03372f..dc33ee4e 100644
--- a/client/components/rules/rulesMain.jade
+++ b/client/components/rules/rulesMain.jade
@@ -4,4 +4,6 @@ template(name="rulesMain")
if($eq rulesCurrentTab.get 'trigger')
+rulesTriggers(ruleName=ruleName triggerVar=triggerVar)
if($eq rulesCurrentTab.get 'action')
- +rulesActions(ruleName=ruleName triggerVar=triggerVar) \ No newline at end of file
+ +rulesActions(ruleName=ruleName triggerVar=triggerVar)
+ if($eq rulesCurrentTab.get 'ruleDetails')
+ +ruleDetails(ruleId=ruleId) \ No newline at end of file
diff --git a/client/components/rules/rulesMain.js b/client/components/rules/rulesMain.js
index 0d7a5c6a..d16b9a41 100644
--- a/client/components/rules/rulesMain.js
+++ b/client/components/rules/rulesMain.js
@@ -46,6 +46,8 @@ BlazeComponent.extendComponent({
},
'click .js-goto-details'(event) {
event.preventDefault();
+ const rule = this.currentData();
+ this.ruleId.set(rule._id)
this.setRuleDetails();
},
diff --git a/client/components/rules/triggers/boardTriggers.jade b/client/components/rules/triggers/boardTriggers.jade
index dec15d86..b5e08c8c 100644
--- a/client/components/rules/triggers/boardTriggers.jade
+++ b/client/components/rules/triggers/boardTriggers.jade
@@ -6,7 +6,7 @@ template(name="boardTriggers")
div.trigger-dropdown
select(id="gen-action")
option(value="created") {{{_'r-added-to'}}}
- option(value="removed") {{{_'r-added-to'}}}
+ option(value="removed") {{{_'r-removed-from'}}}
div.trigger-text
| {{{_'r-the-board'}}}
div.trigger-button.js-add-gen-trigger.js-goto-action
@@ -19,7 +19,7 @@ template(name="boardTriggers")
div.trigger-dropdown
select(id="create-action")
option(value="created") {{{_'r-added-to'}}}
- option(value="removed") {{{_'r-added-to'}}}
+ option(value="removed") {{{_'r-removed-from'}}}
div.trigger-text
| {{{_'r-list'}}}
div.trigger-dropdown
diff --git a/client/components/rules/triggers/boardTriggers.js b/client/components/rules/triggers/boardTriggers.js
index dcc1c187..067c1df8 100644
--- a/client/components/rules/triggers/boardTriggers.js
+++ b/client/components/rules/triggers/boardTriggers.js
@@ -6,51 +6,56 @@ BlazeComponent.extendComponent({
events() {
return [
{'click .js-add-gen-trigger'(event) {
-
+ const desc = Utils.getTriggerActionDesc(event,this);
let datas = this.data();
const actionSelected = this.find('#gen-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
- datas.triggerVar.set({activityType: "createCard","boardId":boardId,"listName":"*"});
+ datas.triggerVar.set({activityType: "createCard","boardId":boardId,"listName":"*","desc":desc});
}
if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "removeCard","boardId":boardId});
+ datas.triggerVar.set({activityType: "removeCard","boardId":boardId,"desc":desc});
}
+
+
},
'click .js-add-create-trigger'(event) {
-
+ const desc = Utils.getTriggerActionDesc(event,this);
let datas = this.data();
const actionSelected = this.find('#create-action').value;
const listName = this.find('#create-list-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "created"){
- datas.triggerVar.set({activityType: "createCard","boardId":boardId,"listName":listName});
+ datas.triggerVar.set({activityType: "createCard","boardId":boardId,"listName":listName,"desc":desc});
}
if(actionSelected == "removed"){
- datas.triggerVar.set({activityType: "removeCard","boardId":boardId,"listName":listName});
+ datas.triggerVar.set({activityType: "removeCard","boardId":boardId,"listName":listName,"desc":desc});
}
},
'click .js-add-moved-trigger'(event) {
let datas = this.data();
+ const desc = Utils.getTriggerActionDesc(event,this);
+
const actionSelected = this.find('#move-action').value;
const listName = this.find('#move-list-name').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "moved-to"){
- datas.triggerVar.set({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"});
+ datas.triggerVar.set({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*","desc":desc});
}
if(actionSelected == "moved-from"){
- datas.triggerVar.set({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName});
+ datas.triggerVar.set({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName,"desc":desc});
}
},
'click .js-add-arc-trigger'(event) {
let datas = this.data();
+ const desc = Utils.getTriggerActionDesc(event,this);
const actionSelected = this.find('#arch-action').value;
const boardId = Session.get('currentBoard')
if(actionSelected == "archived"){
- datas.triggerVar.set({activityType: "archivedCard","boardId":boardId});
+ datas.triggerVar.set({activityType: "archivedCard","boardId":boardId,"desc":desc});
}
if(actionSelected == "unarchived"){
- datas.triggerVar.set({activityType: "restoredCard","boardId":boardId});
+ datas.triggerVar.set({activityType: "restoredCard","boardId":boardId,"desc":desc});
}
}
diff --git a/client/components/rules/triggers/cardTriggers.jade b/client/components/rules/triggers/cardTriggers.jade
index a459a7e0..dd02413c 100644
--- a/client/components/rules/triggers/cardTriggers.jade
+++ b/client/components/rules/triggers/cardTriggers.jade
@@ -22,7 +22,7 @@ template(name="cardTriggers")
option(value="#{_id}")
= name
div.trigger-text
- | is
+ | {{{_'r-is'}}}
div.trigger-dropdown
select(id="spec-label-action")
option(value="added") {{{_'r-added-to'}}}
diff --git a/client/lib/utils.js b/client/lib/utils.js
index 6b8e3524..1b5ad1f3 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -40,14 +40,14 @@ Utils = {
base = 0;
increment = 1;
// If we drop the card in the first position
- } else if (!prevData) {
- base = nextData.sort - 1;
- increment = -1;
+ } else if (!prevData) {
+ base = nextData.sort - 1;
+ increment = -1;
// If we drop the card in the last position
- } else if (!nextData) {
- base = prevData.sort + 1;
- increment = 1;
- }
+ } else if (!nextData) {
+ base = prevData.sort + 1;
+ increment = 1;
+ }
// In the general case take the average of the previous and next element
// sort indexes.
else {
@@ -72,14 +72,14 @@ Utils = {
base = 0;
increment = 1;
// If we drop the card in the first position
- } else if (!prevCardDomElement) {
- base = Blaze.getData(nextCardDomElement).sort - 1;
- increment = -1;
+ } else if (!prevCardDomElement) {
+ base = Blaze.getData(nextCardDomElement).sort - 1;
+ increment = -1;
// If we drop the card in the last position
- } else if (!nextCardDomElement) {
- base = Blaze.getData(prevCardDomElement).sort + 1;
- increment = 1;
- }
+ } else if (!nextCardDomElement) {
+ base = Blaze.getData(prevCardDomElement).sort + 1;
+ increment = 1;
+ }
// In the general case take the average of the previous and next element
// sort indexes.
else {
@@ -121,7 +121,7 @@ Utils = {
return Math.sqrt(
Math.pow(touchA.screenX - touchB.screenX, 2) +
Math.pow(touchA.screenY - touchB.screenY, 2)
- );
+ );
},
enableClickOnTouch(selector) {
@@ -144,6 +144,27 @@ Utils = {
}
});
},
+
+ getTriggerActionDesc(event,tempInstance){
+ const jqueryEl = tempInstance.$(event.currentTarget.parentNode);
+ const triggerEls = jqueryEl.find(".trigger-content").children();
+ let finalString = "";
+ for(let i = 0;i< triggerEls.length;i++){
+ const element = tempInstance.$(triggerEls[i]);
+ if(element.hasClass("trigger-text")){
+ finalString += element.text();
+ }else if(element.find("select").length > 0){
+ finalString += element.find("select option:selected").text();
+ }else if(element.find("input").length > 0){
+ finalString += element.find("input").val();
+ }
+ // Add space
+ if(i != length - 1){
+ finalString += " ";
+ }
+ }
+ return finalString.toLowerCase();
+ },
};
// A simple tracker dependency that we invalidate every time the window is