|
@@ -256,12 +256,20 @@ BlazeComponent.extendComponent({
|
|
|
{
|
|
|
submit(evt) {
|
|
|
evt.preventDefault();
|
|
|
+ const lastList = this.currentBoard.getLastList();
|
|
|
const titleInput = this.find('.list-name-input');
|
|
|
const title = titleInput.value.trim();
|
|
|
- const positionInput = this.find('.list-position-input');
|
|
|
- const position = positionInput.value.trim();
|
|
|
- const ret = Lists.findOne({ boardId: Session.get('currentBoard'), _id: position, archived: false })
|
|
|
- const sortIndex = JSON.stringify(ret['sort'])
|
|
|
+ let sortIndex = 0
|
|
|
+ if (lastList) {
|
|
|
+ const positionInput = this.find('.list-position-input');
|
|
|
+ const position = positionInput.value.trim();
|
|
|
+ const ret = Lists.findOne({ boardId: Session.get('currentBoard'), _id: position, archived: false })
|
|
|
+ sortIndex = parseInt(JSON.stringify(ret['sort']))
|
|
|
+ sortIndex = sortIndex+1
|
|
|
+ } else {
|
|
|
+ sortIndex = Utils.calculateIndexData(lastList, null).base;
|
|
|
+ }
|
|
|
+
|
|
|
if (title) {
|
|
|
Lists.insert({
|
|
|
title,
|