Add copy swimlane functionality

This commit is contained in:
John R. Supplee 2021-04-22 14:05:20 +02:00
parent 2119a3a51e
commit 4940af0573
7 changed files with 101 additions and 59 deletions

View file

@ -147,6 +147,45 @@ Swimlanes.helpers({
});
},
move(toBoardId) {
this.lists().forEach(list => {
const toList = Lists.findOne({
boardId: toBoardId,
title: list.title,
archived: false,
});
let toListId;
if (toList) {
toListId = toList._id;
} else {
toListId = Lists.insert({
title: list.title,
boardId: toBoardId,
type: list.type,
archived: false,
wipLimit: list.wipLimit,
});
}
Cards.find({
listId: list._id,
swimlaneId: this._id,
}).forEach(card => {
card.move(toBoardId, this._id, toListId);
});
});
Swimlanes.update(this._id, {
$set: {
boardId: toBoardId,
},
});
// make sure there is a default swimlane
this.board().getDefaultSwimline();
},
cards() {
return Cards.find(
Filter.mongoSelector({