mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Copy cards cross boards
This commit is contained in:
parent
ba3c3f8289
commit
59f4daf91e
2 changed files with 47 additions and 1 deletions
|
@ -137,8 +137,23 @@ template(name="copyCardPopup")
|
|||
label(for='copy-card-title') {{_ 'title'}}:
|
||||
textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus)
|
||||
= title
|
||||
+boardsAndLists
|
||||
|
||||
template(name="boardsAndLists")
|
||||
select.js-select-boards
|
||||
each boards
|
||||
if $eq _id currentBoard._id
|
||||
option(value="{{_id}}" selected) {{_ 'current'}}
|
||||
else
|
||||
option(value="{{_id}}") {{title}}
|
||||
label {{_ 'lists'}}:
|
||||
+boardLists
|
||||
ul.pop-over-list
|
||||
each aBoardLists
|
||||
li
|
||||
if($eq ../_id _id)
|
||||
a.disabled {{title}} ({{_ 'current'}})
|
||||
else
|
||||
a.js-select-list= title
|
||||
|
||||
template(name="cardMembersPopup")
|
||||
ul.pop-over-list.js-card-member-list
|
||||
|
|
|
@ -214,12 +214,43 @@ Template.moveCardPopup.events({
|
|||
},
|
||||
});
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.selectedBoard = new ReactiveVar(Session.get('currentBoard'));
|
||||
},
|
||||
|
||||
boards() {
|
||||
const boards = Boards.find({
|
||||
archived: false,
|
||||
'members.userId': Meteor.userId(),
|
||||
}, {
|
||||
sort: ['title'],
|
||||
});
|
||||
return boards;
|
||||
},
|
||||
|
||||
aBoardLists() {
|
||||
const board = Boards.findOne(this.selectedBoard.get());
|
||||
return board.lists();
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'change .js-select-boards' (evt) {
|
||||
this.selectedBoard.set($(evt.currentTarget).val());
|
||||
},
|
||||
}];
|
||||
},
|
||||
}).register('boardsAndLists');
|
||||
|
||||
Template.copyCardPopup.events({
|
||||
'click .js-select-list' (evt) {
|
||||
const card = Cards.findOne(Session.get('currentCard'));
|
||||
const oldId = card._id;
|
||||
card._id = null;
|
||||
card.listId = this._id;
|
||||
const list = Lists.findOne(card.listId);
|
||||
card.boardId = list.boardId;
|
||||
const textarea = $(evt.currentTarget).parents('.content').find('textarea');
|
||||
const title = textarea.val().trim();
|
||||
// insert new card to the bottom of new list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue