Allow swimlane creation from template

Mix lists with same name to avoid duplicates
This commit is contained in:
Andrés Manelli 2019-02-23 23:07:54 +01:00
parent f888cfd565
commit 60be4df76e
10 changed files with 100 additions and 35 deletions

View file

@ -463,6 +463,30 @@ Boards.helpers({
return _id;
},
searchSwimlanes(term) {
check(term, Match.OneOf(String, null, undefined));
const query = { boardId: this._id };
if (this.isTemplatesBoard()) {
query.type = 'template-swimlane';
query.archived = false;
} else {
query.type = {$nin: ['template-swimlane']};
}
const projection = { limit: 10, sort: { createdAt: -1 } };
if (term) {
const regex = new RegExp(term, 'i');
query.$or = [
{ title: regex },
{ description: regex },
];
}
return Swimlanes.find(query, projection);
},
searchLists(term) {
check(term, Match.OneOf(String, null, undefined));