mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
Add action: create checklist with items
This commit is contained in:
parent
25968a35cc
commit
4c399a41f7
6 changed files with 84 additions and 1 deletions
|
@ -36,7 +36,16 @@ template(name="boardActions")
|
|||
div.trigger-text
|
||||
| {{_'r-card'}}
|
||||
div.trigger-button.js-add-arch-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-add-swimlane'}}
|
||||
div.trigger-dropdown
|
||||
input(id="swimlane-name",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-button.js-add-swimlane-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,27 @@ BlazeComponent.extendComponent({
|
|||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-swimlane-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const swimlaneName = this.find('#swimlane-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'addSwimlane',
|
||||
swimlaneName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
|
||||
},
|
||||
'click .js-add-spec-move-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
|
|
|
@ -43,6 +43,19 @@ template(name="checklistActions")
|
|||
div.trigger-button.js-add-check-item-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{{_'r-add-checklist'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="checklist-name-3",type=text,placeholder="{{{_'r-name'}}}")
|
||||
div.trigger-text
|
||||
| {{{_'r-with-items'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="checklist-items",type=text,placeholder="{{{_'r-items-list'}}}")
|
||||
div.trigger-button.js-add-checklist-items-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,29 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-checklist-items-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const checklistName = this.find('#checklist-name-3').value;
|
||||
const checklistItems = this.find('#checklist-items').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'addChecklistWithItems',
|
||||
checklistName,
|
||||
checklistItems,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
|
||||
},
|
||||
'click .js-add-checklist-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
|
|
|
@ -615,6 +615,10 @@
|
|||
"r-d-add-checklist": "Add checklist",
|
||||
"r-d-remove-checklist": "Remove checklist",
|
||||
"r-by": "by",
|
||||
"r-add-checklist": "Add checklist",
|
||||
"r-with-items": "with items",
|
||||
"r-items-list": "item1,item2,item3",
|
||||
"r-add-swimlane": "Add swimlane",
|
||||
"r-swimlane": "in swimlane",
|
||||
"r-swimlane-name": "swimlane name",
|
||||
"r-user-name": "username",
|
||||
|
|
|
@ -132,6 +132,19 @@ RulesHelper = {
|
|||
if(action.actionType === 'removeChecklist'){
|
||||
Checklists.remove({'title':action.checklistName, 'cardId':card._id, 'sort':0});
|
||||
}
|
||||
if(action.actionType === 'addSwimlane'){
|
||||
Swimlanes.insert({
|
||||
title: action.swimlaneName,
|
||||
boardId
|
||||
});
|
||||
}
|
||||
if(action.actionType === 'addChecklistWithItems'){
|
||||
const checkListId = Checklists.insert({'title':action.checklistName, 'cardId':card._id, 'sort':0});
|
||||
const itemsArray = action.checklistItems.split(',');
|
||||
for(let i = 0;i <itemsArray.length;i++){
|
||||
ChecklistItems.insert({title:itemsArray[i],checklistId:checkListId,cardId:card._id,'sort':0});
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue