mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 03:10:12 +01:00
Fix move selection
This fixes https://github.com/wekan/wekan/issues/3119.
This commit is contained in:
parent
8eafa1ac66
commit
5c02850bc1
3 changed files with 46 additions and 3 deletions
|
|
@ -157,8 +157,9 @@ Template.disambiguateMultiMemberPopup.events({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.moveSelectionPopup.events({
|
Template.moveSelectionPopup.events({
|
||||||
'click .js-select-list'() {
|
'click .js-select-list'(event) {
|
||||||
mutateSelectedCards('move', this._id);
|
// Move the minicard to the end of the target list
|
||||||
|
mutateSelectedCards('moveToEndOfList', { listId: this._id });
|
||||||
EscapeActions.executeUpTo('multiselection');
|
EscapeActions.executeUpTo('multiselection');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ template(name="swimlane")
|
||||||
.swimlane
|
.swimlane
|
||||||
+swimlaneHeader
|
+swimlaneHeader
|
||||||
unless collapseSwimlane
|
unless collapseSwimlane
|
||||||
.swimlane.js-lists.js-swimlane
|
.swimlane.js-lists.js-swimlane(id="swimlane-{{_id}}")
|
||||||
if isMiniScreen
|
if isMiniScreen
|
||||||
if currentListIsInThisSwimlane _id
|
if currentListIsInThisSwimlane _id
|
||||||
+list(currentList)
|
+list(currentList)
|
||||||
|
|
|
||||||
|
|
@ -1255,6 +1255,48 @@ Cards.mutations({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
moveToEndOfList({ listId } = {}) {
|
||||||
|
let swimlaneId = this.swimlaneId;
|
||||||
|
const boardId = this.boardId;
|
||||||
|
let sortIndex = 0;
|
||||||
|
|
||||||
|
// This should never happen, but there was a bug that was fixed in commit
|
||||||
|
// ea0239538a68e225c867411a4f3e0d27c158383.
|
||||||
|
if (!swimlaneId) {
|
||||||
|
const board = Boards.findOne(boardId);
|
||||||
|
swimlaneId = board.getDefaultSwimline()._id;
|
||||||
|
}
|
||||||
|
// Move the minicard to the end of the target list
|
||||||
|
let parentElementDom = $(`#swimlane-${this.swimlaneId}`).get(0);
|
||||||
|
if (!parentElementDom) parentElementDom = $(':root');
|
||||||
|
|
||||||
|
const lastCardDom = $(parentElementDom)
|
||||||
|
.find(`#js-list-${listId} .js-minicard:last`)
|
||||||
|
.get(0);
|
||||||
|
if (lastCardDom) sortIndex = Utils.calculateIndex(lastCardDom, null).base;
|
||||||
|
|
||||||
|
return this.moveOptionalArgs({
|
||||||
|
boardId: boardId,
|
||||||
|
swimlaneId: swimlaneId,
|
||||||
|
listId: listId,
|
||||||
|
sort: sortIndex,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
moveOptionalArgs({ boardId, swimlaneId, listId, sort } = {}) {
|
||||||
|
boardId = boardId ?? this.boardId;
|
||||||
|
swimlaneId = swimlaneId ?? this.swimlaneId;
|
||||||
|
// This should never happen, but there was a bug that was fixed in commit
|
||||||
|
// ea0239538a68e225c867411a4f3e0d27c158383.
|
||||||
|
if (!swimlaneId) {
|
||||||
|
const board = Boards.findOne(boardId);
|
||||||
|
swimlaneId = board.getDefaultSwimline()._id;
|
||||||
|
}
|
||||||
|
listId = listId ?? this.listId;
|
||||||
|
sort = sort ?? this.sort;
|
||||||
|
return this.move(boardId, swimlaneId, listId, sort);
|
||||||
|
},
|
||||||
|
|
||||||
move(boardId, swimlaneId, listId, sort) {
|
move(boardId, swimlaneId, listId, sort) {
|
||||||
// Copy Custom Fields
|
// Copy Custom Fields
|
||||||
if (this.boardId !== boardId) {
|
if (this.boardId !== boardId) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue