mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
insert linked card, move sortIndex to function
This commit is contained in:
parent
29216599e4
commit
c29cff3822
1 changed files with 14 additions and 9 deletions
|
@ -498,6 +498,19 @@ BlazeComponent.extendComponent({
|
|||
});
|
||||
},
|
||||
|
||||
getSortIndex() {
|
||||
const position = this.currentData().position;
|
||||
let ret;
|
||||
if (position === 'top') {
|
||||
const firstCardDom = this.list.find('.js-minicard:first')[0];
|
||||
ret = Utils.calculateIndex(null, firstCardDom).base;
|
||||
} else if (position === 'bottom') {
|
||||
const lastCardDom = this.list.find('.js-minicard:last')[0];
|
||||
ret = Utils.calculateIndex(lastCardDom, null).base;
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
@ -520,15 +533,7 @@ BlazeComponent.extendComponent({
|
|||
Popup.back();
|
||||
return;
|
||||
}
|
||||
const position = this.currentData().position;
|
||||
let sortIndex;
|
||||
if (position === 'top') {
|
||||
const firstCardDom = this.list.find('.js-minicard:first')[0];
|
||||
sortIndex = Utils.calculateIndex(null, firstCardDom).base;
|
||||
} else if (position === 'bottom') {
|
||||
const lastCardDom = this.list.find('.js-minicard:last')[0];
|
||||
sortIndex = Utils.calculateIndex(lastCardDom, null).base;
|
||||
}
|
||||
const sortIndex = this.getSortIndex();
|
||||
const _id = Cards.insert({
|
||||
title: $('.js-select-cards option:selected').text(), //dummy
|
||||
listId: this.listId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue