mirror of
https://github.com/wekan/wekan.git
synced 2026-01-23 09:46:09 +01:00
Fix list view issues. Allow creation of boards from templates
This commit is contained in:
parent
13c2157e36
commit
dc7286a0ef
12 changed files with 122 additions and 35 deletions
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue