mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Change the swimlaneid of a card only if a new target swimlaneid is selected
Fixes the issue https://github.com/wekan/wekan/issues/2757. While at it, fix the same issue also for multi selection.
This commit is contained in:
parent
94e47401cb
commit
64fa02cdf5
1 changed files with 14 additions and 10 deletions
|
|
@ -74,18 +74,16 @@ BlazeComponent.extendComponent({
|
||||||
const sortIndex = calculateIndex(prevCardDom, nextCardDom, nCards);
|
const sortIndex = calculateIndex(prevCardDom, nextCardDom, nCards);
|
||||||
const listId = Blaze.getData(ui.item.parents('.list').get(0))._id;
|
const listId = Blaze.getData(ui.item.parents('.list').get(0))._id;
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
let swimlaneId = '';
|
const defaultSwimlaneId = currentBoard.getDefaultSwimline()._id;
|
||||||
|
let targetSwimlaneId = null;
|
||||||
|
|
||||||
|
// only set a new swimelane ID if the swimlanes view is active
|
||||||
if (
|
if (
|
||||||
Utils.boardView() === 'board-view-swimlanes' ||
|
Utils.boardView() === 'board-view-swimlanes' ||
|
||||||
currentBoard.isTemplatesBoard()
|
currentBoard.isTemplatesBoard()
|
||||||
)
|
)
|
||||||
swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id;
|
targetSwimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))
|
||||||
else if (
|
._id;
|
||||||
Utils.boardView() === 'board-view-lists' ||
|
|
||||||
Utils.boardView() === 'board-view-cal' ||
|
|
||||||
!Utils.boardView
|
|
||||||
)
|
|
||||||
swimlaneId = currentBoard.getDefaultSwimline()._id;
|
|
||||||
|
|
||||||
// Normally the jquery-ui sortable library moves the dragged DOM element
|
// Normally the jquery-ui sortable library moves the dragged DOM element
|
||||||
// to its new position, which disrupts Blaze reactive updates mechanism
|
// to its new position, which disrupts Blaze reactive updates mechanism
|
||||||
|
|
@ -98,9 +96,12 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
if (MultiSelection.isActive()) {
|
if (MultiSelection.isActive()) {
|
||||||
Cards.find(MultiSelection.getMongoSelector()).forEach((card, i) => {
|
Cards.find(MultiSelection.getMongoSelector()).forEach((card, i) => {
|
||||||
|
const newSwimlaneId = targetSwimlaneId
|
||||||
|
? targetSwimlaneId
|
||||||
|
: card.swimlaneId || defaultSwimlaneId;
|
||||||
card.move(
|
card.move(
|
||||||
currentBoard._id,
|
currentBoard._id,
|
||||||
swimlaneId,
|
newSwimlaneId,
|
||||||
listId,
|
listId,
|
||||||
sortIndex.base + i * sortIndex.increment,
|
sortIndex.base + i * sortIndex.increment,
|
||||||
);
|
);
|
||||||
|
|
@ -108,7 +109,10 @@ BlazeComponent.extendComponent({
|
||||||
} else {
|
} else {
|
||||||
const cardDomElement = ui.item.get(0);
|
const cardDomElement = ui.item.get(0);
|
||||||
const card = Blaze.getData(cardDomElement);
|
const card = Blaze.getData(cardDomElement);
|
||||||
card.move(currentBoard._id, swimlaneId, listId, sortIndex.base);
|
const newSwimlaneId = targetSwimlaneId
|
||||||
|
? targetSwimlaneId
|
||||||
|
: card.swimlaneId || defaultSwimlaneId;
|
||||||
|
card.move(currentBoard._id, newSwimlaneId, listId, sortIndex.base);
|
||||||
}
|
}
|
||||||
boardComponent.setIsDragging(false);
|
boardComponent.setIsDragging(false);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue