mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
Added create card action
This commit is contained in:
parent
12827ef0a6
commit
8ad0da2109
4 changed files with 62 additions and 0 deletions
|
@ -47,6 +47,23 @@ template(name="boardActions")
|
|||
div.trigger-button.js-add-swimlane-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-create-card'}}
|
||||
div.trigger-dropdown
|
||||
input(id="card-name",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-text
|
||||
| {{_'r-in-list'}}
|
||||
div.trigger-dropdown
|
||||
input(id="list-name",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-text
|
||||
| {{_'r-in-swimlane'}}
|
||||
div.trigger-dropdown
|
||||
input(id="swimlane-name2",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-button.js-create-card-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,31 @@ BlazeComponent.extendComponent({
|
|||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-create-card-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const cardName = this.find('#card-name').value;
|
||||
const listName = this.find('#list-name').value;
|
||||
const swimlaneName = this.find('#swimlane-name2').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'createCard',
|
||||
swimlaneName,
|
||||
cardName,
|
||||
listName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
|
||||
},
|
||||
'click .js-add-swimlane-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
|
|
|
@ -604,6 +604,9 @@
|
|||
"r-d-unarchive": "Restore card from Archive",
|
||||
"r-d-add-label": "Add label",
|
||||
"r-d-remove-label": "Remove label",
|
||||
"r-create-card": "Create new card",
|
||||
"r-in-list": "in list",
|
||||
"r-in-swimlane": "in swimlane",
|
||||
"r-d-add-member": "Add member",
|
||||
"r-d-remove-member": "Remove member",
|
||||
"r-d-remove-all-member": "Remove all member",
|
||||
|
|
|
@ -145,6 +145,23 @@ RulesHelper = {
|
|||
ChecklistItems.insert({title:itemsArray[i],checklistId:checkListId,cardId:card._id,'sort':0});
|
||||
}
|
||||
}
|
||||
if(action.actionType === 'createCard'){
|
||||
let list = Lists.findOne({title:action.listName,boardId});
|
||||
let listId = '';
|
||||
let swimlaneId = '';
|
||||
let swimlane = Swimlanes.findOne({title:action.swimlaneName,boardId});
|
||||
if(list == undefined){
|
||||
listId = '';
|
||||
}else{
|
||||
listId = list._id;
|
||||
}
|
||||
if(swimlane == undefined){
|
||||
swimlaneId = Swimlanes.findOne({title:"Default",boardId})._id;
|
||||
}else{
|
||||
swimlaneId = swimlane._id;
|
||||
}
|
||||
Cards.insert({title:action.cardName,listId,swimlaneId,sort:0,boardId});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue