mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Fix card copy and move with swimlanes
This commit is contained in:
parent
98103bb2f7
commit
4b53b0c90a
2 changed files with 36 additions and 19 deletions
|
|
@ -166,6 +166,7 @@ template(name="copyChecklistToManyCardsPopup")
|
||||||
+boardsAndLists
|
+boardsAndLists
|
||||||
|
|
||||||
template(name="boardsAndLists")
|
template(name="boardsAndLists")
|
||||||
|
label {{_ 'boards'}}:
|
||||||
select.js-select-boards
|
select.js-select-boards
|
||||||
each boards
|
each boards
|
||||||
if $eq _id currentBoard._id
|
if $eq _id currentBoard._id
|
||||||
|
|
@ -173,14 +174,18 @@ template(name="boardsAndLists")
|
||||||
else
|
else
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
|
|
||||||
|
label {{_ 'swimlanes'}}:
|
||||||
|
select.js-select-swimlanes
|
||||||
|
each swimlanes
|
||||||
|
option(value="{{_id}}") {{title}}
|
||||||
|
|
||||||
label {{_ 'lists'}}:
|
label {{_ 'lists'}}:
|
||||||
ul.pop-over-list
|
select.js-select-lists
|
||||||
each aBoardLists
|
each aBoardLists
|
||||||
li
|
option(value="{{_id}}") {{title}}
|
||||||
if $eq ../_id _id
|
|
||||||
a.disabled {{title}} ({{_ 'current'}})
|
.edit-controls.clearfix
|
||||||
else
|
button.primary.confirm.js-done {{_ 'done'}}
|
||||||
a.js-select-list= title
|
|
||||||
|
|
||||||
template(name="cardMembersPopup")
|
template(name="cardMembersPopup")
|
||||||
ul.pop-over-list.js-card-member-list
|
ul.pop-over-list.js-card-member-list
|
||||||
|
|
|
||||||
|
|
@ -211,11 +211,14 @@ Template.editCardTitleForm.events({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.moveCardPopup.events({
|
Template.moveCardPopup.events({
|
||||||
'click .js-select-list' () {
|
'click .js-done' () {
|
||||||
// XXX We should *not* get the currentCard from the global state, but
|
// XXX We should *not* get the currentCard from the global state, but
|
||||||
// instead from a “component” state.
|
// instead from a “component” state.
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Cards.findOne(Session.get('currentCard'));
|
||||||
const newListId = this._id;
|
const lSelect = $('.js-select-lists')[0];
|
||||||
|
const newListId = lSelect.options[lSelect.selectedIndex].value;
|
||||||
|
const slSelect = $('.js-select-swimlanes')[0];
|
||||||
|
card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
|
||||||
card.move(card.swimlaneId, newListId, 0);
|
card.move(card.swimlaneId, newListId, 0);
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
|
|
@ -223,7 +226,8 @@ Template.moveCardPopup.events({
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.selectedBoard = new ReactiveVar(Session.get('currentBoard'));
|
subManager.subscribe('board', Session.get('currentBoard'));
|
||||||
|
this.selectedBoardId = new ReactiveVar(Session.get('currentBoard'));
|
||||||
},
|
},
|
||||||
|
|
||||||
boards() {
|
boards() {
|
||||||
|
|
@ -236,32 +240,41 @@ BlazeComponent.extendComponent({
|
||||||
return boards;
|
return boards;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
swimlanes() {
|
||||||
|
const board = Boards.findOne(this.selectedBoardId.get());
|
||||||
|
return board.swimlanes();
|
||||||
|
},
|
||||||
|
|
||||||
aBoardLists() {
|
aBoardLists() {
|
||||||
subManager.subscribe('board', this.selectedBoard.get());
|
const board = Boards.findOne(this.selectedBoardId.get());
|
||||||
const board = Boards.findOne(this.selectedBoard.get());
|
|
||||||
return board.lists();
|
return board.lists();
|
||||||
},
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
'change .js-select-boards'(evt) {
|
'change .js-select-boards'(evt) {
|
||||||
this.selectedBoard.set($(evt.currentTarget).val());
|
this.selectedBoardId.set($(evt.currentTarget).val());
|
||||||
|
subManager.subscribe('board', this.selectedBoardId.get());
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
}).register('boardsAndLists');
|
}).register('boardsAndLists');
|
||||||
|
|
||||||
Template.copyCardPopup.events({
|
Template.copyCardPopup.events({
|
||||||
'click .js-select-list' (evt) {
|
'click .js-done'() {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Cards.findOne(Session.get('currentCard'));
|
||||||
const oldId = card._id;
|
const oldId = card._id;
|
||||||
card._id = null;
|
card._id = null;
|
||||||
card.listId = this._id;
|
const lSelect = $('.js-select-lists')[0];
|
||||||
const list = Lists.findOne(card.listId);
|
card.listId = lSelect.options[lSelect.selectedIndex].value;
|
||||||
card.boardId = list.boardId;
|
const slSelect = $('.js-select-swimlanes')[0];
|
||||||
const textarea = $(evt.currentTarget).parents('.content').find('textarea');
|
card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
|
||||||
|
const bSelect = $('.js-select-boards')[0];
|
||||||
|
card.boardId = bSelect.options[bSelect.selectedIndex].value;
|
||||||
|
const textarea = $('#copy-card-title');
|
||||||
const title = textarea.val().trim();
|
const title = textarea.val().trim();
|
||||||
// insert new card to the bottom of new list
|
// insert new card to the bottom of new list
|
||||||
card.sort = Lists.findOne(this._id).cards().count();
|
card.sort = Lists.findOne(card.listId).cards().count();
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
card.title = title;
|
card.title = title;
|
||||||
|
|
@ -297,7 +310,6 @@ Template.copyCardPopup.events({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Template.copyChecklistToManyCardsPopup.events({
|
Template.copyChecklistToManyCardsPopup.events({
|
||||||
'click .js-select-list' (evt) {
|
'click .js-select-list' (evt) {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Cards.findOne(Session.get('currentCard'));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue