summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Gallarello <angelo.gallarell@gmail.com>2018-12-30 22:08:34 +0100
committerAngelo Gallarello <angelo.gallarell@gmail.com>2018-12-30 22:08:34 +0100
commita2d756074f05299248944ecce2cc87a9a28ab020 (patch)
tree2c3e61af27e8cce64caea39a3e642a0eae18857c
parentb2f23d619d1ff33e899080dca17d018f0e8d0963 (diff)
downloadwekan-a2d756074f05299248944ecce2cc87a9a28ab020.tar.gz
wekan-a2d756074f05299248944ecce2cc87a9a28ab020.tar.bz2
wekan-a2d756074f05299248944ecce2cc87a9a28ab020.zip
Added swimlane trigger
-rw-r--r--client/components/rules/triggers/boardTriggers.jade35
-rw-r--r--client/components/rules/triggers/boardTriggers.js37
-rw-r--r--client/components/rules/triggers/cardTriggers.jade10
-rw-r--r--client/components/rules/triggers/checklistTriggers.jade12
-rw-r--r--client/lib/utils.js13
-rw-r--r--i18n/en.i18n.json5
-rw-r--r--models/cards.js2
-rw-r--r--server/triggersDef.js4
8 files changed, 62 insertions, 56 deletions
diff --git a/client/components/rules/triggers/boardTriggers.jade b/client/components/rules/triggers/boardTriggers.jade
index b0f2b44f..abf2ee6d 100644
--- a/client/components/rules/triggers/boardTriggers.jade
+++ b/client/components/rules/triggers/boardTriggers.jade
@@ -3,10 +3,8 @@ template(name="boardTriggers")
div.trigger-content
div.trigger-text
| {{_'r-when-a-card-is'}}
- div.trigger-dropdown
- select(id="gen-action")
- option(value="created") {{_'r-added-to'}}
- option(value="removed") {{_'r-removed-from'}}
+ div.trigger-text
+ | {{_'r-added-to'}}
div.trigger-text
| {{_'r-the-board'}}
div.trigger-button.trigger-button-person.js-show-user-field
@@ -15,7 +13,7 @@ template(name="boardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-trigger.js-goto-action
i.fa.fa-plus
@@ -23,21 +21,23 @@ template(name="boardTriggers")
div.trigger-content
div.trigger-text
| {{_'r-when-a-card-is'}}
- div.trigger-dropdown
- select(id="create-action")
- option(value="created") {{_'r-added-to'}}
- option(value="removed") {{_'r-removed-from'}}
+ div.trigger-text
+ | {{_'r-added-to'}}
div.trigger-text
| {{_'r-list'}}
div.trigger-dropdown
- input(id="create-list-name",type=text,placeholder="{{_'r-list-name'}}")
+ input(id="create-list-name",type=text,placeholder="{{_'r-list-name'}}")
+ div.trigger-text
+ | {{_'r-swimlane'}}
+ div.trigger-dropdown
+ input(id="create-swimlane-name",type=text,placeholder="{{_'r-swimlane-name'}}")
div.trigger-button.trigger-button-person.js-show-user-field
i.fa.fa-user
div.user-details.hide-element
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-create-trigger.js-goto-action
i.fa.fa-plus
@@ -51,7 +51,7 @@ template(name="boardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-moved-trigger.js-goto-action
i.fa.fa-plus
@@ -66,14 +66,19 @@ template(name="boardTriggers")
div.trigger-text
| {{_'r-list'}}
div.trigger-dropdown
- input(id="move-list-name",type=text,placeholder="{{_'r-list-name'}}")
+ input(id="move-list-name",type=text,placeholder="{{_'r-list-name'}}")
+ div.trigger-text
+ | {{_'r-swimlane'}}
+ div.trigger-dropdown
+ input(id="create-swimlane-name",type=text,placeholder="{{_'r-swimlane-name'}}")
+ div.trigger-button.trigger-button-person.js-show-user-field
div.trigger-button.trigger-button-person.js-show-user-field
i.fa.fa-user
div.user-details.hide-element
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-moved-trigger.js-goto-action
i.fa.fa-plus
@@ -91,7 +96,7 @@ template(name="boardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-arch-trigger.js-goto-action
i.fa.fa-plus
diff --git a/client/components/rules/triggers/boardTriggers.js b/client/components/rules/triggers/boardTriggers.js
index 40c5b07e..b822d643 100644
--- a/client/components/rules/triggers/boardTriggers.js
+++ b/client/components/rules/triggers/boardTriggers.js
@@ -8,60 +8,48 @@ BlazeComponent.extendComponent({
'click .js-add-gen-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
const datas = this.data();
- const actionSelected = this.find('#gen-action').value;
const boardId = Session.get('currentBoard');
- if (actionSelected === 'created') {
- datas.triggerVar.set({
+ datas.triggerVar.set({
activityType: 'createCard',
boardId,
'listName': '*',
desc,
});
- }
- if (actionSelected === 'removed') {
- datas.triggerVar.set({
- activityType: 'removeCard',
- boardId,
- desc,
- });
- }
},
'click .js-add-create-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
const datas = this.data();
- const actionSelected = this.find('#create-action').value;
const listName = this.find('#create-list-name').value;
+ const swimlaneName = this.find('#create-swimlane-name').value;
+ if(swimlaneName == undefined || swimlaneName == ""){
+ swimlaneName = "*";
+ }
const boardId = Session.get('currentBoard');
- if (actionSelected === 'created') {
- datas.triggerVar.set({
+ datas.triggerVar.set({
activityType: 'createCard',
boardId,
+ swimlaneName,
listName,
desc,
});
- }
- if (actionSelected === 'removed') {
- datas.triggerVar.set({
- activityType: 'removeCard',
- boardId,
- listName,
- desc,
- });
- }
},
'click .js-add-moved-trigger' (event) {
const datas = this.data();
const desc = Utils.getTriggerActionDesc(event, this);
-
+ const swimlaneName = this.find('#create-swimlane-name').value;
const actionSelected = this.find('#move-action').value;
const listName = this.find('#move-list-name').value;
const boardId = Session.get('currentBoard');
+ if(swimlaneName == undefined || swimlaneName == ""){
+ swimlaneName = "*";
+ }
if (actionSelected === 'moved-to') {
datas.triggerVar.set({
activityType: 'moveCard',
boardId,
listName,
+ swimlaneName,
'oldListName': '*',
desc,
});
@@ -70,6 +58,7 @@ BlazeComponent.extendComponent({
datas.triggerVar.set({
activityType: 'moveCard',
boardId,
+ swimlaneName,
'listName': '*',
'oldListName': listName,
desc,
diff --git a/client/components/rules/triggers/cardTriggers.jade b/client/components/rules/triggers/cardTriggers.jade
index 52594986..54133451 100644
--- a/client/components/rules/triggers/cardTriggers.jade
+++ b/client/components/rules/triggers/cardTriggers.jade
@@ -15,7 +15,7 @@ template(name="cardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-label-trigger.js-goto-action
i.fa.fa-plus
@@ -42,7 +42,7 @@ template(name="cardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-spec-label-trigger.js-goto-action
i.fa.fa-plus
@@ -62,7 +62,7 @@ template(name="cardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-member-trigger.js-goto-action
i.fa.fa-plus
@@ -87,7 +87,7 @@ template(name="cardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-spec-member-trigger.js-goto-action
i.fa.fa-plus
@@ -109,6 +109,6 @@ template(name="cardTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-attachment-trigger.js-goto-action
i.fa.fa-plus
diff --git a/client/components/rules/triggers/checklistTriggers.jade b/client/components/rules/triggers/checklistTriggers.jade
index a563e93b..8745b364 100644
--- a/client/components/rules/triggers/checklistTriggers.jade
+++ b/client/components/rules/triggers/checklistTriggers.jade
@@ -15,7 +15,7 @@ template(name="checklistTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-check-trigger.js-goto-action
i.fa.fa-plus
@@ -40,7 +40,7 @@ template(name="checklistTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-spec-check-trigger.js-goto-action
i.fa.fa-plus
@@ -58,7 +58,7 @@ template(name="checklistTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-comp-trigger.js-goto-action
i.fa.fa-plus
@@ -80,7 +80,7 @@ template(name="checklistTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-spec-comp-trigger.js-goto-action
i.fa.fa-plus
@@ -98,7 +98,7 @@ template(name="checklistTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
i.fa.fa-plus
@@ -120,6 +120,6 @@ template(name="checklistTriggers")
div.trigger-text
| {{_'r-by'}}
div.trigger-dropdown
- input(class="user-name",id="create-list-name",type=text,placeholder="{{_'r-user-name'}}")
+ input(class="user-name",type=text,placeholder="{{_'r-user-name'}}")
div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
i.fa.fa-plus
diff --git a/client/lib/utils.js b/client/lib/utils.js
index 5ec62ef9..f252a220 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -219,12 +219,19 @@ Utils = {
if (element.hasClass('trigger-text')) {
finalString += element.text().toLowerCase();
} else if (element.hasClass('user-details')) {
- console.log(element);
- finalString += element.find('.trigger-text').text().toLowerCase()+ " " + element.find('input').val();
+ let username = element.find('input').val();
+ if(username == undefined || username == ""){
+ username = "*";
+ }
+ finalString += element.find('.trigger-text').text().toLowerCase()+ " " + username ;
} else if (element.find('select').length > 0) {
finalString += element.find('select option:selected').text().toLowerCase();
} else if (element.find('input').length > 0) {
- finalString += element.find('input').val();
+ let inputvalue = element.find('input').val();
+ if(inputvalue == undefined || inputvalue == ""){
+ inputvalue = "*";
+ }
+ finalString += inputvalue;
}
// Add space
if (i !== length - 1) {
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 9a18cc22..d4745b22 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -549,7 +549,7 @@
"r-a-card": "a card",
"r-when-a-label-is": "When a label is",
"r-when-the-label-is": "When the label is",
- "r-list-name": "List name",
+ "r-list-name": "list name",
"r-when-a-member": "When a member is",
"r-when-the-member": "When the member",
"r-name": "name",
@@ -611,7 +611,10 @@
"r-d-add-checklist": "Add checklist",
"r-d-remove-checklist": "Remove checklist",
"r-by": "by",
+ "r-swimlane": "in swimlane",
+ "r-swimlane-name": "swimlane name",
"r-user-name": "username",
+ "r-added-to": "added to",
"r-when-a-card-is-moved": "When a card is moved to another list",
"ldap": "LDAP",
"oauth2": "OAuth2",
diff --git a/models/cards.js b/models/cards.js
index bcd16ece..a7217c5d 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -1128,6 +1128,7 @@ function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) {
listId: doc.listId,
boardId: doc.boardId,
cardId: doc._id,
+ swimlaneName: Swimlanes.findOne(doc.swimlaneId).title,
swimlaneId: doc.swimlaneId,
oldSwimlaneId,
});
@@ -1237,6 +1238,7 @@ function cardCreation(userId, doc) {
listName: Lists.findOne(doc.listId).title,
listId: doc.listId,
cardId: doc._id,
+ swimlaneName: Swimlanes.findOne(doc.swimlaneId).title,
swimlaneId: doc.swimlaneId,
});
}
diff --git a/server/triggersDef.js b/server/triggersDef.js
index 73779d05..0f573ba5 100644
--- a/server/triggersDef.js
+++ b/server/triggersDef.js
@@ -1,9 +1,9 @@
TriggersDef = {
createCard:{
- matchingFields: ['boardId', 'listName','userId'],
+ matchingFields: ['boardId', 'listName','userId','swimlaneName'],
},
moveCard:{
- matchingFields: ['boardId', 'listName', 'oldListName','userId'],
+ matchingFields: ['boardId', 'listName', 'oldListName','userId','swimlaneName'],
},
archivedCard:{
matchingFields: ['boardId','userId'],