mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 22:17:16 -04:00
Fixed triggers to use names and not id
This commit is contained in:
parent
2f24dcfc7d
commit
3b62b5ec5d
7 changed files with 157 additions and 54 deletions
|
@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
|
|||
const actionSelected = this.find('#gen-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "created"){
|
||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
|
||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
|
@ -27,20 +27,13 @@ BlazeComponent.extendComponent({
|
|||
const actionSelected = this.find('#create-action').value;
|
||||
const listName = this.find('#create-list-name').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){
|
||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listName":listName},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){
|
||||
Triggers.insert({activityType: "removeCard","boardId":boardId,"listName":listName},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
|
@ -50,22 +43,13 @@ BlazeComponent.extendComponent({
|
|||
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){
|
||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "moved-from"){
|
||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){
|
||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When a checklist is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
select(id="gen-check-action")
|
||||
option(value="created") 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-check-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
@ -18,16 +18,16 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When the checklist
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="Name")
|
||||
input(id="check-name",type=text,placeholder="Name")
|
||||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
select(id="spec-check-action")
|
||||
option(value="created") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| a card
|
||||
div.trigger-button.js-add-checklist-trigger.js-goto-action
|
||||
div.trigger-button.js-add-spec-check-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -35,10 +35,10 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When a checklist is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Completed
|
||||
option(value="removed") Made incomplete
|
||||
div.trigger-button.js-add-gen.member-trigger.js-goto-action
|
||||
select(id="gen-comp-check-action")
|
||||
option(value="completed") Completed
|
||||
option(value="uncompleted") Made incomplete
|
||||
div.trigger-button.js-add-gen-comp-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -46,14 +46,14 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When the checklist
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="Name")
|
||||
input(id="spec-comp-check-name",type=text,placeholder="Name")
|
||||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Completed
|
||||
option(value="removed") Made incomplete
|
||||
div.trigger-button.js-add-checklist-trigger.js-goto-action
|
||||
select(id="spec-comp-check-action")
|
||||
option(value="completed") Completed
|
||||
option(value="uncompleted") Made incomplete
|
||||
div.trigger-button.js-add-spec-comp-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -61,10 +61,10 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When a checklist item is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Checked
|
||||
option(value="removed") Unchecked
|
||||
div.trigger-button.js-add-gen.member-trigger.js-goto-action
|
||||
select(id="check-item-gen-action")
|
||||
option(value="checked") Checked
|
||||
option(value="unchecked") Unchecked
|
||||
div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -72,12 +72,12 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When the checklist item
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="Name")
|
||||
input(id="check-item-name",type=text,placeholder="Name")
|
||||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") Checked
|
||||
option(value="removed") Unchecked
|
||||
div.trigger-button.js-add-checklist-trigger.js-goto-action
|
||||
select(id="check-item-spec-action")
|
||||
option(value="checked") Checked
|
||||
option(value="unchecked") Unchecked
|
||||
div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
108
client/components/rules/triggers/checklistTriggers.js
Normal file
108
client/components/rules/triggers/checklistTriggers.js
Normal file
|
@ -0,0 +1,108 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
},
|
||||
events() {
|
||||
return [
|
||||
{'click .js-add-gen-check-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#gen-check-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "created"){
|
||||
Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-check-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#spec-check-action').value;
|
||||
const checklistId = this.find('#check-name').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "created"){
|
||||
Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-gen-comp-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#gen-comp-check-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "completed"){
|
||||
Triggers.insert({activityType: "completeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "uncompleted"){
|
||||
Triggers.insert({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-comp-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#spec-comp-check-action').value;
|
||||
const checklistId = this.find('#spec-comp-check-name').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-gen-check-item-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#check-item-gen-action').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "checked"){
|
||||
Triggers.insert({activityType: "checkedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "unchecked"){
|
||||
Triggers.insert({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-check-item-trigger'(event) {
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#check-item-spec-action').value;
|
||||
const checklistItemId = this.find('#check-item-name').value;
|
||||
const boardId = Session.get('currentBoard')
|
||||
if(actionSelected == "added"){
|
||||
Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
if(actionSelected == "removed"){
|
||||
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('checklistTriggers');
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue