Fix list view issues. Allow creation of boards from templates

This commit is contained in:
Andrés Manelli 2019-02-25 22:48:25 +01:00
parent 13c2157e36
commit dc7286a0ef
12 changed files with 122 additions and 35 deletions

View file

@ -315,6 +315,21 @@ Boards.attachSchema(new SimpleSchema({
Boards.helpers({
copy() {
const oldId = this._id;
delete this._id;
const _id = Boards.insert(this);
// Copy all swimlanes in board
Swimlanes.find({
boardId: oldId,
archived: false,
}).forEach((swimlane) => {
swimlane.type = 'swimlane';
swimlane.boardId = _id;
swimlane.copy(oldId);
});
},
/**
* Is supplied user authorized to view this board?
*/
@ -463,6 +478,27 @@ Boards.helpers({
return _id;
},
searchBoards(term) {
check(term, Match.OneOf(String, null, undefined));
const query = { boardId: this._id };
query.type = 'cardType-linkedBoard';
query.archived = false;
const projection = { limit: 10, sort: { createdAt: -1 } };
if (term) {
const regex = new RegExp(term, 'i');
query.$or = [
{ title: regex },
{ description: regex },
];
}
return Cards.find(query, projection);
},
searchSwimlanes(term) {
check(term, Match.OneOf(String, null, undefined));