mirror of
https://github.com/wekan/wekan.git
synced 2025-12-30 14:18:48 +01:00
Allow list creation from template
This commit is contained in:
parent
044126188d
commit
f888cfd565
8 changed files with 121 additions and 26 deletions
|
|
@ -463,6 +463,30 @@ Boards.helpers({
|
|||
return _id;
|
||||
},
|
||||
|
||||
searchLists(term) {
|
||||
check(term, Match.OneOf(String, null, undefined));
|
||||
|
||||
const query = { boardId: this._id };
|
||||
if (this.isTemplatesBoard()) {
|
||||
query.type = 'template-list';
|
||||
query.archived = false;
|
||||
} else {
|
||||
query.type = {$nin: ['template-list']};
|
||||
}
|
||||
const projection = { limit: 10, sort: { createdAt: -1 } };
|
||||
|
||||
if (term) {
|
||||
const regex = new RegExp(term, 'i');
|
||||
|
||||
query.$or = [
|
||||
{ title: regex },
|
||||
{ description: regex },
|
||||
];
|
||||
}
|
||||
|
||||
return Lists.find(query, projection);
|
||||
},
|
||||
|
||||
searchCards(term, excludeLinked) {
|
||||
check(term, Match.OneOf(String, null, undefined));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue