mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 09:50:13 +01:00
Merge branch 'GhassenRjab-feature/import-checklist-sort' into devel
Import checklist sort attributes from Wekan and Trello. Thanks to GhassenRjab ! Related #876
This commit is contained in:
commit
cf8e1da383
3 changed files with 14 additions and 2 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
# Upcoming Wekan release
|
||||||
|
|
||||||
|
This release adds the following new features:
|
||||||
|
|
||||||
|
* [Import checklist sort attributes from Wekan and Trello](https://github.com/wekan/wekan/pull/1226)
|
||||||
|
|
||||||
|
Thanks to GitHub user GhassenRjab for contributions.
|
||||||
|
|
||||||
# v0.38 2017-09-14 Wekan release
|
# v0.38 2017-09-14 Wekan release
|
||||||
|
|
||||||
This release adds the following new features:
|
This release adds the following new features:
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,7 @@ export class TrelloCreator {
|
||||||
cardId: this.cards[checklist.idCard],
|
cardId: this.cards[checklist.idCard],
|
||||||
title: checklist.name,
|
title: checklist.name,
|
||||||
createdAt: this._now(),
|
createdAt: this._now(),
|
||||||
|
sort: checklist.pos,
|
||||||
};
|
};
|
||||||
const checklistId = Checklists.direct.insert(checklistToCreate);
|
const checklistId = Checklists.direct.insert(checklistToCreate);
|
||||||
// keep track of Trello id => WeKan id
|
// keep track of Trello id => WeKan id
|
||||||
|
|
@ -414,6 +415,7 @@ export class TrelloCreator {
|
||||||
_id: checklistId + itemsToCreate.length,
|
_id: checklistId + itemsToCreate.length,
|
||||||
title: item.name,
|
title: item.name,
|
||||||
isFinished: item.state === 'complete',
|
isFinished: item.state === 'complete',
|
||||||
|
sort: item.pos,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
||||||
|
|
|
||||||
|
|
@ -410,23 +410,25 @@ export class WekanCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
createChecklists(wekanChecklists) {
|
createChecklists(wekanChecklists) {
|
||||||
wekanChecklists.forEach((checklist) => {
|
wekanChecklists.forEach((checklist, checklistIndex) => {
|
||||||
// Create the checklist
|
// Create the checklist
|
||||||
const checklistToCreate = {
|
const checklistToCreate = {
|
||||||
cardId: this.cards[checklist.cardId],
|
cardId: this.cards[checklist.cardId],
|
||||||
title: checklist.title,
|
title: checklist.title,
|
||||||
createdAt: checklist.createdAt,
|
createdAt: checklist.createdAt,
|
||||||
|
sort: checklist.sort ? checklist.sort : checklistIndex,
|
||||||
};
|
};
|
||||||
const checklistId = Checklists.direct.insert(checklistToCreate);
|
const checklistId = Checklists.direct.insert(checklistToCreate);
|
||||||
// keep track of Wekan id => WeKan id
|
// keep track of Wekan id => WeKan id
|
||||||
this.checklists[checklist._id] = checklistId;
|
this.checklists[checklist._id] = checklistId;
|
||||||
// Now add the items to the checklist
|
// Now add the items to the checklist
|
||||||
const itemsToCreate = [];
|
const itemsToCreate = [];
|
||||||
checklist.items.forEach((item) => {
|
checklist.items.forEach((item, itemIndex) => {
|
||||||
itemsToCreate.push({
|
itemsToCreate.push({
|
||||||
_id: checklistId + itemsToCreate.length,
|
_id: checklistId + itemsToCreate.length,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
isFinished: item.isFinished,
|
isFinished: item.isFinished,
|
||||||
|
sort: item.sort ? item.sort : itemIndex,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue