summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Gallarello <angelo.gallarell@gmail.com>2018-12-29 16:59:50 +0100
committerAngelo Gallarello <angelo.gallarell@gmail.com>2018-12-29 16:59:50 +0100
commit9d1d66b0f5253c571f07c0f7c6250f5a725ddbb1 (patch)
tree98aef9029a736c0ffc8551a6f189b62beccc10df
parentef6aa4e415233eff6baa9a918e5b77b9b8bf53eb (diff)
downloadwekan-9d1d66b0f5253c571f07c0f7c6250f5a725ddbb1.tar.gz
wekan-9d1d66b0f5253c571f07c0f7c6250f5a725ddbb1.tar.bz2
wekan-9d1d66b0f5253c571f07c0f7c6250f5a725ddbb1.zip
Added triggers by username
-rw-r--r--client/components/rules/rules.styl7
-rw-r--r--client/components/rules/rulesMain.js19
-rw-r--r--client/components/rules/triggers/boardTriggers.jade37
-rw-r--r--client/components/rules/triggers/cardTriggers.jade35
-rw-r--r--client/components/rules/triggers/checklistTriggers.jade42
-rw-r--r--i18n/en.i18n.json2
-rw-r--r--server/triggersDef.js36
7 files changed, 158 insertions, 20 deletions
diff --git a/client/components/rules/rules.styl b/client/components/rules/rules.styl
index b52f84a7..4679e039 100644
--- a/client/components/rules/rules.styl
+++ b/client/components/rules/rules.styl
@@ -10,7 +10,10 @@
display: inline-block
float: left
margin: revert
-
+.hide-element
+ display:none !important
+.user-details
+ display:inline-block
.rules-btns-group
position: absolute
right: 0
@@ -160,6 +163,8 @@
box-shadow: 0 0 0 2px darken(white, 60%) inset
.trigger-button.trigger-button-email
top:30px
+ .trigger-button.trigger-button-person
+ right:-40px
.trigger-item.trigger-item-mail
height:300px
diff --git a/client/components/rules/rulesMain.js b/client/components/rules/rulesMain.js
index 0752a541..566fd3e5 100644
--- a/client/components/rules/rulesMain.js
+++ b/client/components/rules/rulesMain.js
@@ -42,8 +42,27 @@ BlazeComponent.extendComponent({
},
'click .js-goto-action' (event) {
event.preventDefault();
+ // Add user to the trigger
+ const username = $(event.currentTarget.offsetParent).find(".user-name").val();
+ let trigger = this.triggerVar.get();
+ const user = Users.findOne({"username":username});
+ if(user != undefined){
+ trigger["userId"] = user._id;
+ }else{
+ trigger["userId"] = "*";
+ }
+ this.triggerVar.set(trigger);
this.setAction();
},
+ 'click .js-show-user-field' (event) {
+ event.preventDefault();
+ console.log(event);
+ console.log(event.currentTarget.offsetParent);
+ console.log($(event.currentTarget.offsetParent));
+ $(event.currentTarget.offsetParent).find(".user-details").removeClass("hide-element");
+
+
+ },
'click .js-goto-rules' (event) {
event.preventDefault();
this.setRulesList();
diff --git a/client/components/rules/triggers/boardTriggers.jade b/client/components/rules/triggers/boardTriggers.jade
index 48b9345c..b0f2b44f 100644
--- a/client/components/rules/triggers/boardTriggers.jade
+++ b/client/components/rules/triggers/boardTriggers.jade
@@ -9,6 +9,13 @@ template(name="boardTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-the-board'}}
+ 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'}}")
div.trigger-button.js-add-gen-trigger.js-goto-action
i.fa.fa-plus
@@ -23,7 +30,14 @@ template(name="boardTriggers")
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-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'}}")
div.trigger-button.js-add-create-trigger.js-goto-action
i.fa.fa-plus
@@ -31,6 +45,13 @@ template(name="boardTriggers")
div.trigger-content
div.trigger-text
| {{_'r-when-a-card-is-moved'}}
+ 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'}}")
div.trigger-button.js-add-gen-moved-trigger.js-goto-action
i.fa.fa-plus
@@ -46,6 +67,13 @@ template(name="boardTriggers")
| {{_'r-list'}}
div.trigger-dropdown
input(id="move-list-name",type=text,placeholder="{{_'r-list-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'}}")
div.trigger-button.js-add-moved-trigger.js-goto-action
i.fa.fa-plus
@@ -57,6 +85,13 @@ template(name="boardTriggers")
select(id="arch-action")
option(value="archived") {{_'r-archived'}}
option(value="unarchived") {{_'r-unarchived'}}
+ 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'}}")
div.trigger-button.js-add-arch-trigger.js-goto-action
i.fa.fa-plus
diff --git a/client/components/rules/triggers/cardTriggers.jade b/client/components/rules/triggers/cardTriggers.jade
index 5226e3c4..52594986 100644
--- a/client/components/rules/triggers/cardTriggers.jade
+++ b/client/components/rules/triggers/cardTriggers.jade
@@ -9,6 +9,13 @@ template(name="cardTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
div.trigger-button.js-add-gen-label-trigger.js-goto-action
i.fa.fa-plus
@@ -29,6 +36,13 @@ template(name="cardTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
div.trigger-button.js-add-spec-label-trigger.js-goto-action
i.fa.fa-plus
@@ -42,6 +56,13 @@ template(name="cardTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
div.trigger-button.js-add-gen-member-trigger.js-goto-action
i.fa.fa-plus
@@ -60,6 +81,13 @@ template(name="cardTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
div.trigger-button.js-add-spec-member-trigger.js-goto-action
i.fa.fa-plus
@@ -75,5 +103,12 @@ template(name="cardTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
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 c6cd99a6..a563e93b 100644
--- a/client/components/rules/triggers/checklistTriggers.jade
+++ b/client/components/rules/triggers/checklistTriggers.jade
@@ -9,6 +9,13 @@ template(name="checklistTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
div.trigger-button.js-add-gen-check-trigger.js-goto-action
i.fa.fa-plus
@@ -27,6 +34,13 @@ template(name="checklistTriggers")
option(value="removed") {{_'r-removed-from'}}
div.trigger-text
| {{_'r-a-card'}}
+ 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'}}")
div.trigger-button.js-add-spec-check-trigger.js-goto-action
i.fa.fa-plus
@@ -38,6 +52,13 @@ template(name="checklistTriggers")
select(id="gen-comp-check-action")
option(value="completed") {{_'r-completed'}}
option(value="uncompleted") {{_'r-made-incomplete'}}
+ 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'}}")
div.trigger-button.js-add-gen-comp-trigger.js-goto-action
i.fa.fa-plus
@@ -53,6 +74,13 @@ template(name="checklistTriggers")
select(id="spec-comp-check-action")
option(value="completed") {{_'r-completed'}}
option(value="uncompleted") {{_'r-made-incomplete'}}
+ 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'}}")
div.trigger-button.js-add-spec-comp-trigger.js-goto-action
i.fa.fa-plus
@@ -64,6 +92,13 @@ template(name="checklistTriggers")
select(id="check-item-gen-action")
option(value="checked") {{_'r-checked'}}
option(value="unchecked") {{_'r-unchecked'}}
+ 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'}}")
div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
i.fa.fa-plus
@@ -79,5 +114,12 @@ template(name="checklistTriggers")
select(id="check-item-spec-action")
option(value="checked") {{_'r-checked'}}
option(value="unchecked") {{_'r-unchecked'}}
+ 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'}}")
div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
i.fa.fa-plus
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index a4138f14..9a18cc22 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -610,6 +610,8 @@
"r-d-check-of-list": "of checklist",
"r-d-add-checklist": "Add checklist",
"r-d-remove-checklist": "Remove checklist",
+ "r-by": "by",
+ "r-user-name": "username",
"r-when-a-card-is-moved": "When a card is moved to another list",
"ldap": "LDAP",
"oauth2": "OAuth2",
diff --git a/server/triggersDef.js b/server/triggersDef.js
index f6d5333b..73779d05 100644
--- a/server/triggersDef.js
+++ b/server/triggersDef.js
@@ -1,57 +1,57 @@
TriggersDef = {
createCard:{
- matchingFields: ['boardId', 'listName'],
+ matchingFields: ['boardId', 'listName','userId'],
},
moveCard:{
- matchingFields: ['boardId', 'listName', 'oldListName'],
+ matchingFields: ['boardId', 'listName', 'oldListName','userId'],
},
archivedCard:{
- matchingFields: ['boardId'],
+ matchingFields: ['boardId','userId'],
},
restoredCard:{
- matchingFields: ['boardId'],
+ matchingFields: ['boardId','userId'],
},
joinMember:{
- matchingFields: ['boardId', 'username'],
+ matchingFields: ['boardId', 'username','userId'],
},
unjoinMember:{
- matchingFields: ['boardId', 'username'],
+ matchingFields: ['boardId', 'username','userId'],
},
addChecklist:{
- matchingFields: ['boardId', 'checklistName'],
+ matchingFields: ['boardId', 'checklistName','userId'],
},
removeChecklist:{
- matchingFields: ['boardId', 'checklistName'],
+ matchingFields: ['boardId', 'checklistName','userId'],
},
completeChecklist:{
- matchingFields: ['boardId', 'checklistName'],
+ matchingFields: ['boardId', 'checklistName','userId'],
},
uncompleteChecklist:{
- matchingFields: ['boardId', 'checklistName'],
+ matchingFields: ['boardId', 'checklistName','userId'],
},
addedChecklistItem:{
- matchingFields: ['boardId', 'checklistItemName'],
+ matchingFields: ['boardId', 'checklistItemName','userId'],
},
removedChecklistItem:{
- matchingFields: ['boardId', 'checklistItemName'],
+ matchingFields: ['boardId', 'checklistItemName','userId'],
},
checkedItem:{
- matchingFields: ['boardId', 'checklistItemName'],
+ matchingFields: ['boardId', 'checklistItemName','userId'],
},
uncheckedItem:{
- matchingFields: ['boardId', 'checklistItemName'],
+ matchingFields: ['boardId', 'checklistItemName','userId'],
},
addAttachment:{
- matchingFields: ['boardId'],
+ matchingFields: ['boardId','userId'],
},
deleteAttachment:{
- matchingFields: ['boardId'],
+ matchingFields: ['boardId','userId'],
},
addedLabel:{
- matchingFields: ['boardId', 'labelId'],
+ matchingFields: ['boardId', 'labelId','userId'],
},
removedLabel:{
- matchingFields: ['boardId', 'labelId'],
+ matchingFields: ['boardId', 'labelId','userId'],
},
};