mirror of
https://github.com/wekan/wekan.git
synced 2026-01-01 15:18:49 +01:00
Add missing code of fix insertion order of list.
Thanks to xet7 ! Fixes https://github.com/wekan/wekan/pull/5767, fixes #5732
This commit is contained in:
parent
6418263165
commit
7d1a1475ba
1 changed files with 31 additions and 29 deletions
|
|
@ -250,43 +250,45 @@ BlazeComponent.extendComponent({
|
|||
return [
|
||||
{
|
||||
submit(evt) {
|
||||
evt.preventDefault();
|
||||
evt.preventDefault();
|
||||
|
||||
const titleInput = this.find('.list-name-input');
|
||||
const title = titleInput?.value.trim();
|
||||
const titleInput = this.find('.list-name-input');
|
||||
const title = titleInput?.value.trim();
|
||||
|
||||
if (!title) return;
|
||||
if (!title) return;
|
||||
|
||||
let sortIndex = 0;
|
||||
const lastList = this.currentBoard.getLastList();
|
||||
const boardId = Utils.getCurrentBoardId();
|
||||
let sortIndex = 0;
|
||||
const lastList = this.currentBoard.getLastList();
|
||||
const boardId = Utils.getCurrentBoardId();
|
||||
|
||||
const positionInput = this.find('.list-position-input');
|
||||
const positionInput = this.find('.list-position-input');
|
||||
|
||||
if (positionInput) {
|
||||
const positionId = positionInput.value.trim();
|
||||
const selectedList = ReactiveCache.getList({ boardId, _id: positionId, archived: false });
|
||||
if (positionInput) {
|
||||
const positionId = positionInput.value.trim();
|
||||
const selectedList = ReactiveCache.getList({ boardId, _id: positionId, archived: false });
|
||||
|
||||
if (selectedList) {
|
||||
sortIndex = selectedList.sort + 1;
|
||||
} else {
|
||||
sortIndex = Utils.calculateIndexData(lastList, null).base;
|
||||
}
|
||||
} else {
|
||||
sortIndex = Utils.calculateIndexData(lastList, null).base;
|
||||
}
|
||||
if (selectedList) {
|
||||
sortIndex = selectedList.sort + 1;
|
||||
} else {
|
||||
sortIndex = Utils.calculateIndexData(lastList, null).base;
|
||||
}
|
||||
} else {
|
||||
sortIndex = Utils.calculateIndexData(lastList, null).base;
|
||||
}
|
||||
|
||||
Lists.insert({
|
||||
title,
|
||||
boardId: Session.get('currentBoard'),
|
||||
sort: sortIndex,
|
||||
type: this.isListTemplatesSwimlane ? 'template-list' : 'list',
|
||||
swimlaneId: this.currentBoard.isTemplatesBoard() ? this.currentSwimlane._id : '',
|
||||
});
|
||||
|
||||
titleInput.value = '';
|
||||
titleInput.focus();
|
||||
Lists.insert({
|
||||
title,
|
||||
boardId: Session.get('currentBoard'),
|
||||
sort: sortIndex,
|
||||
type: this.isListTemplatesSwimlane ? 'template-list' : 'list',
|
||||
swimlaneId: this.currentBoard.isTemplatesBoard() ? this.currentSwimlane._id : '',
|
||||
});
|
||||
|
||||
titleInput.value = '';
|
||||
titleInput.focus();
|
||||
}
|
||||
},
|
||||
{
|
||||
'click .js-list-template': Popup.open('searchElement'),
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue