Define sort property on swimlanes and lists

This commit is contained in:
zebby76 2018-05-01 07:55:41 +02:00
parent 359d0b376f
commit 539c1ab87a
3 changed files with 9 additions and 5 deletions

View file

@ -379,6 +379,7 @@ export class TrelloCreator {
// we require. // we require.
createdAt: this._now(this.createdAt.lists[list.id]), createdAt: this._now(this.createdAt.lists[list.id]),
title: list.name, title: list.name,
sort: list.pos,
}; };
const listId = Lists.direct.insert(listToCreate); const listId = Lists.direct.insert(listToCreate);
Lists.direct.update(listId, {$set: {'updatedAt': this._now()}}); Lists.direct.update(listId, {$set: {'updatedAt': this._now()}});
@ -410,6 +411,7 @@ export class TrelloCreator {
// we require. // we require.
createdAt: this._now(), createdAt: this._now(),
title: 'Default', title: 'Default',
sort: 1,
}; };
const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate); const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}}); Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});

View file

@ -566,10 +566,11 @@ if (Meteor.isServer) {
Swimlanes.insert({ Swimlanes.insert({
title: TAPi18n.__('welcome-swimlane'), title: TAPi18n.__('welcome-swimlane'),
boardId, boardId,
sort: 1,
}, fakeUser); }, fakeUser);
['welcome-list1', 'welcome-list2'].forEach((title) => { ['welcome-list1', 'welcome-list2'].forEach((title, titleIndex) => {
Lists.insert({title: TAPi18n.__(title), boardId}, fakeUser); Lists.insert({title: TAPi18n.__(title), boardId, sort: titleIndex}, fakeUser);
}); });
}); });
}); });
@ -754,4 +755,3 @@ if (Meteor.isServer) {
} }
}); });
} }

View file

@ -390,7 +390,7 @@ export class WekanCreator {
} }
createLists(wekanLists, boardId) { createLists(wekanLists, boardId) {
wekanLists.forEach((list) => { wekanLists.forEach((list, listIndex) => {
const listToCreate = { const listToCreate = {
archived: list.archived, archived: list.archived,
boardId, boardId,
@ -400,6 +400,7 @@ export class WekanCreator {
// we require. // we require.
createdAt: this._now(this.createdAt.lists[list.id]), createdAt: this._now(this.createdAt.lists[list.id]),
title: list.title, title: list.title,
sort: list.sort ? list.sort : listIndex,
}; };
const listId = Lists.direct.insert(listToCreate); const listId = Lists.direct.insert(listToCreate);
Lists.direct.update(listId, {$set: {'updatedAt': this._now()}}); Lists.direct.update(listId, {$set: {'updatedAt': this._now()}});
@ -422,7 +423,7 @@ export class WekanCreator {
} }
createSwimlanes(wekanSwimlanes, boardId) { createSwimlanes(wekanSwimlanes, boardId) {
wekanSwimlanes.forEach((swimlane) => { wekanSwimlanes.forEach((swimlane, swimlaneIndex) => {
const swimlaneToCreate = { const swimlaneToCreate = {
archived: swimlane.archived, archived: swimlane.archived,
boardId, boardId,
@ -432,6 +433,7 @@ export class WekanCreator {
// we require. // we require.
createdAt: this._now(this.createdAt.swimlanes[swimlane._id]), createdAt: this._now(this.createdAt.swimlanes[swimlane._id]),
title: swimlane.title, title: swimlane.title,
sort: swimlane.sort ? swimlane.sort : swimlaneIndex,
}; };
const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate); const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}}); Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});