mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
Progress on triggers UI
This commit is contained in:
parent
fda4e954eb
commit
2f24dcfc7d
6 changed files with 100 additions and 87 deletions
|
@ -34,7 +34,7 @@ template(name="boardActivities")
|
|||
.activity-checklist(href="{{ card.absoluteUrl }}")
|
||||
+viewer
|
||||
= checklist.title
|
||||
if($eq activityType 'removedChecklist')
|
||||
if($eq activityType 'removeChecklist')
|
||||
| {{{_ 'activity-checklist-removed' cardLink}}}.
|
||||
|
||||
if($eq activityType 'checkedItem')
|
||||
|
@ -151,6 +151,9 @@ template(name="cardActivities")
|
|||
if($eq activityType 'removedLabel')
|
||||
| {{{_ 'activity-removed-label-card' lastLabel }}}.
|
||||
|
||||
if($eq activityType 'removeChecklist')
|
||||
| {{{_ 'activity-checklist-removed' cardLabel}}}.
|
||||
|
||||
if($eq activityType 'checkedItem')
|
||||
| {{{_ 'activity-checked-item-card' checkItem checklist.title }}}.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
template(name="rulesActions")
|
||||
h2
|
||||
i.fa.fa-cutlery
|
||||
| Rule "#{data.ruleName}" - Add action
|
||||
| Rule "#{data.ruleName.get}" - Add action
|
||||
.triggers-content
|
||||
.triggers-body
|
||||
.triggers-side-menu
|
||||
|
|
|
@ -4,8 +4,8 @@ template(name="cardTriggers")
|
|||
div.trigger-text
|
||||
| When a label is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Added to
|
||||
select(id="label-action")
|
||||
option(value="added") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| a card
|
||||
|
@ -17,19 +17,19 @@ template(name="cardTriggers")
|
|||
div.trigger-text
|
||||
| When the label
|
||||
div.trigger-dropdown
|
||||
select(id="label")
|
||||
select(id="spec-label")
|
||||
each labels
|
||||
option
|
||||
option(value="#{_id}")
|
||||
= name
|
||||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Added to
|
||||
select(id="spec-label-action")
|
||||
option(value="added") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| a card
|
||||
div.trigger-button.js-add-label-trigger.js-goto-action
|
||||
div.trigger-button.js-add-spec-label-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -37,12 +37,12 @@ template(name="cardTriggers")
|
|||
div.trigger-text
|
||||
| When a member is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Added to
|
||||
select(id="gen-member-action")
|
||||
option(value="added") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| a card
|
||||
div.trigger-button.js-add-gen.member-trigger.js-goto-action
|
||||
div.trigger-button.js-add-gen-member-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
@ -51,16 +51,16 @@ template(name="cardTriggers")
|
|||
div.trigger-text
|
||||
| When the member
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="name")
|
||||
input(id="spec-member",type=text,placeholder="name")
|
||||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Added to
|
||||
select(id="spec-member-action")
|
||||
option(value="added") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| a card
|
||||
div.trigger-button.js-add-member-trigger.js-goto-action
|
||||
div.trigger-button.js-add-spec-member-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -70,8 +70,8 @@ template(name="cardTriggers")
|
|||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Added to
|
||||
select(id="attach-action")
|
||||
option(value="added") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| a card
|
||||
|
|
|
@ -16,87 +16,86 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
events() {
|
||||
return [
|
||||
{'click .js-add-gen-trigger'(event) {
|
||||
{'click .js-add-gen-label-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#gen-action').value;
|
||||
const actionSelected = this.find('#label-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "created"){
|
||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "addedLabel","boardId":boardId,"labelId":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "removeCard","boardId":boardId},function(error,id){
|
||||
Triggers.insert({activityType: "removedLabel","boardId":boardId,"labelId":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-create-trigger'(event) {
|
||||
|
||||
'click .js-add-spec-label-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#create-action').value;
|
||||
const listName = this.find('#create-list-name').value;
|
||||
const actionSelected = this.find('#spec-label-action').value;
|
||||
const labelId = this.find('#spec-label').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
const list = Lists.findOne({title:listName});
|
||||
let listId;
|
||||
if(list == undefined){
|
||||
listId = "*"
|
||||
}else{
|
||||
listId = list._id;
|
||||
}
|
||||
if(actionSelected == "created"){
|
||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listId":listId},function(error,id){
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "addedLabel","boardId":boardId,"labelId":labelId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){
|
||||
Triggers.insert({activityType: "removedLabel","boardId":boardId,"labelId":labelId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-moved-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#move-action').value;
|
||||
const listName = this.find('#move-list-name').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
const list = Lists.findOne({title:listName});
|
||||
console.log(list);
|
||||
let listId;
|
||||
if(list == undefined){
|
||||
listId = "*"
|
||||
}else{
|
||||
listId = list._id;
|
||||
}
|
||||
console.log(listId);
|
||||
if(actionSelected == "moved-to"){
|
||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":listId,"oldListId":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "moved-from"){
|
||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-arc-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#arch-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "archived"){
|
||||
Triggers.insert({activityType: "archivedCard","boardId":boardId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "unarchived"){
|
||||
Triggers.insert({activityType: "restoredCard","boardId":boardId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
'click .js-add-gen-member-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#gen-member-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "joinMember","boardId":boardId,"memberId":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"memberId":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-member-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#spec-member-action').value;
|
||||
const memberId = this.find('#spec-member').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "joinMember","boardId":boardId,"memberId":memberId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"memberId":memberId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-attachment-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#attach-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "addAttachment","boardId":boardId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "deleteAttachment","boardId":boardId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
RulesHelper = {
|
||||
|
||||
|
||||
executeRules(activity){
|
||||
const matchingRules = this.findMatchingRules(activity);
|
||||
console.log(matchingRules);
|
||||
|
@ -33,7 +31,7 @@ RulesHelper = {
|
|||
return matchingRules;
|
||||
},
|
||||
buildMatchingFieldsMap(activity, matchingFields){
|
||||
let matchingMap = {};
|
||||
let matchingMap = {"activityType":activity.activityType};
|
||||
for(let i = 0;i< matchingFields.length;i++){
|
||||
// Creating a matching map with the actual field of the activity
|
||||
// and with the wildcard (for example: trigger when a card is added
|
||||
|
|
|
@ -14,7 +14,7 @@ TriggersDef = {
|
|||
joinMember:{
|
||||
matchingFields: ["boardId","memberId"]
|
||||
},
|
||||
unJoinMember:{
|
||||
unjoinMember:{
|
||||
matchingFields: ["boardId","memberId"]
|
||||
},
|
||||
addChecklist:{
|
||||
|
@ -23,23 +23,36 @@ TriggersDef = {
|
|||
removeChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
},
|
||||
addChecklistItem:{
|
||||
completeChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
},
|
||||
uncompleteChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
},
|
||||
addedChecklistItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
},
|
||||
removedChecklistItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
},
|
||||
checkedItem:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
},
|
||||
uncheckedItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
},
|
||||
addAttachment:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
matchingFields: ["boardId"]
|
||||
},
|
||||
deleteAttachment:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
matchingFields: ["boardId"]
|
||||
},
|
||||
addedLabel:{
|
||||
matchingFields: ["boardId","labelId"]
|
||||
},
|
||||
removedLabel:{
|
||||
matchingFields: ["boardId","labelId"]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue