mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01: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() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|
@ -520,15 +533,7 @@ BlazeComponent.extendComponent({
|
||||||
Popup.back();
|
Popup.back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const position = this.currentData().position;
|
const sortIndex = this.getSortIndex();
|
||||||
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 _id = Cards.insert({
|
const _id = Cards.insert({
|
||||||
title: $('.js-select-cards option:selected').text(), //dummy
|
title: $('.js-select-cards option:selected').text(), //dummy
|
||||||
listId: this.listId,
|
listId: this.listId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue