mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Add template search in Add Card menu
Archive all cards in list when list is archived Remove default board in link popup Only list non-template boards in card link and search
This commit is contained in:
parent
1e72177991
commit
7a6afb8aea
5 changed files with 57 additions and 31 deletions
|
|
@ -54,6 +54,10 @@ template(name="addCardForm")
|
||||||
|
|
|
|
||||||
| /
|
| /
|
||||||
a.js-search {{_ 'search'}}
|
a.js-search {{_ 'search'}}
|
||||||
|
span.quiet
|
||||||
|
|
|
||||||
|
| /
|
||||||
|
a.js-search-template {{_ 'template'}}
|
||||||
|
|
||||||
template(name="autocompleteLabelLine")
|
template(name="autocompleteLabelLine")
|
||||||
.minicard-label(class="card-label-{{colorName}}" title=labelName)
|
.minicard-label(class="card-label-{{colorName}}" title=labelName)
|
||||||
|
|
@ -63,11 +67,9 @@ template(name="linkCardPopup")
|
||||||
label {{_ 'boards'}}:
|
label {{_ 'boards'}}:
|
||||||
.link-board-wrapper
|
.link-board-wrapper
|
||||||
select.js-select-boards
|
select.js-select-boards
|
||||||
|
option(value="")
|
||||||
each boards
|
each boards
|
||||||
if $eq _id currentBoard._id
|
option(value="{{_id}}") {{title}}
|
||||||
option(value="{{_id}}" selected) {{_ 'current'}}
|
|
||||||
else
|
|
||||||
option(value="{{_id}}") {{title}}
|
|
||||||
input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
|
input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
|
||||||
|
|
||||||
label {{_ 'swimlanes'}}:
|
label {{_ 'swimlanes'}}:
|
||||||
|
|
@ -90,14 +92,15 @@ template(name="linkCardPopup")
|
||||||
input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")
|
input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")
|
||||||
|
|
||||||
template(name="searchCardPopup")
|
template(name="searchCardPopup")
|
||||||
label {{_ 'boards'}}:
|
unless isTemplateSearch
|
||||||
.link-board-wrapper
|
label {{_ 'boards'}}:
|
||||||
select.js-select-boards
|
.link-board-wrapper
|
||||||
each boards
|
select.js-select-boards
|
||||||
if $eq _id currentBoard._id
|
each boards
|
||||||
option(value="{{_id}}" selected) {{_ 'current'}}
|
if $eq _id currentBoard._id
|
||||||
else
|
option(value="{{_id}}" selected) {{_ 'current'}}
|
||||||
option(value="{{_id}}") {{title}}
|
else
|
||||||
|
option(value="{{_id}}") {{title}}
|
||||||
form.js-search-term-form
|
form.js-search-term-form
|
||||||
input(type="text" name="searchTerm" placeholder="{{_ 'search-example'}}" autofocus)
|
input(type="text" name="searchTerm" placeholder="{{_ 'search-example'}}" autofocus)
|
||||||
.list-body.js-perfect-scrollbar.search-card-results
|
.list-body.js-perfect-scrollbar.search-card-results
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,7 @@ BlazeComponent.extendComponent({
|
||||||
keydown: this.pressKey,
|
keydown: this.pressKey,
|
||||||
'click .js-link': Popup.open('linkCard'),
|
'click .js-link': Popup.open('linkCard'),
|
||||||
'click .js-search': Popup.open('searchCard'),
|
'click .js-search': Popup.open('searchCard'),
|
||||||
|
'click .js-search-template': Popup.open('searchCard'),
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -390,17 +391,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
// Prefetch first non-current board id
|
this.selectedBoardId = new ReactiveVar('');
|
||||||
const boardId = Boards.findOne({
|
|
||||||
archived: false,
|
|
||||||
'members.userId': Meteor.userId(),
|
|
||||||
_id: {$ne: Session.get('currentBoard')},
|
|
||||||
}, {
|
|
||||||
sort: ['title'],
|
|
||||||
})._id;
|
|
||||||
// Subscribe to this board
|
|
||||||
subManager.subscribe('board', boardId);
|
|
||||||
this.selectedBoardId = new ReactiveVar(boardId);
|
|
||||||
this.selectedSwimlaneId = new ReactiveVar('');
|
this.selectedSwimlaneId = new ReactiveVar('');
|
||||||
this.selectedListId = new ReactiveVar('');
|
this.selectedListId = new ReactiveVar('');
|
||||||
|
|
||||||
|
|
@ -426,6 +417,7 @@ BlazeComponent.extendComponent({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: {$ne: Session.get('currentBoard')},
|
_id: {$ne: Session.get('currentBoard')},
|
||||||
|
type: 'board',
|
||||||
}, {
|
}, {
|
||||||
sort: ['title'],
|
sort: ['title'],
|
||||||
});
|
});
|
||||||
|
|
@ -433,7 +425,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
swimlanes() {
|
swimlanes() {
|
||||||
if (!this.selectedBoardId) {
|
if (!this.selectedBoardId.get()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()});
|
const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()});
|
||||||
|
|
@ -443,7 +435,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
if (!this.selectedBoardId) {
|
if (!this.selectedBoardId.get()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const lists = Lists.find({boardId: this.selectedBoardId.get()});
|
const lists = Lists.find({boardId: this.selectedBoardId.get()});
|
||||||
|
|
@ -531,12 +523,18 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
onCreated() {
|
onCreated() {
|
||||||
// Prefetch first non-current board id
|
const isTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-search-template');
|
||||||
let board = Boards.findOne({
|
let board = {};
|
||||||
archived: false,
|
if (isTemplateSearch) {
|
||||||
'members.userId': Meteor.userId(),
|
board = Boards.findOne(Meteor.user().profile.templatesBoardId);
|
||||||
_id: {$ne: Session.get('currentBoard')},
|
} else {
|
||||||
});
|
// Prefetch first non-current board id
|
||||||
|
board = Boards.findOne({
|
||||||
|
archived: false,
|
||||||
|
'members.userId': Meteor.userId(),
|
||||||
|
_id: {$ne: Session.get('currentBoard')},
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!board) {
|
if (!board) {
|
||||||
Popup.close();
|
Popup.close();
|
||||||
return;
|
return;
|
||||||
|
|
@ -568,6 +566,7 @@ BlazeComponent.extendComponent({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: {$ne: Session.get('currentBoard')},
|
_id: {$ne: Session.get('currentBoard')},
|
||||||
|
type: 'board',
|
||||||
}, {
|
}, {
|
||||||
sort: ['title'],
|
sort: ['title'],
|
||||||
});
|
});
|
||||||
|
|
@ -610,3 +609,9 @@ BlazeComponent.extendComponent({
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
}).register('searchCardPopup');
|
}).register('searchCardPopup');
|
||||||
|
|
||||||
|
Template.searchCardPopup.helpers({
|
||||||
|
isTemplateSearch() {
|
||||||
|
return $(Popup._getTopStack().openerElement).hasClass('js-search-template');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@
|
||||||
"restore-board": "Restore Board",
|
"restore-board": "Restore Board",
|
||||||
"no-archived-boards": "No Boards in Archive.",
|
"no-archived-boards": "No Boards in Archive.",
|
||||||
"archives": "Archive",
|
"archives": "Archive",
|
||||||
|
"template": "Template",
|
||||||
"templates": "Templates",
|
"templates": "Templates",
|
||||||
"assign-member": "Assign member",
|
"assign-member": "Assign member",
|
||||||
"attached": "attached",
|
"attached": "attached",
|
||||||
|
|
|
||||||
|
|
@ -470,6 +470,10 @@ Boards.helpers({
|
||||||
if (excludeLinked) {
|
if (excludeLinked) {
|
||||||
query.linkedId = null;
|
query.linkedId = null;
|
||||||
}
|
}
|
||||||
|
if (this.isTemplatesBoard()) {
|
||||||
|
query.type = 'template-card';
|
||||||
|
query.archived = false;
|
||||||
|
}
|
||||||
const projection = { limit: 10, sort: { createdAt: -1 } };
|
const projection = { limit: 10, sort: { createdAt: -1 } };
|
||||||
|
|
||||||
if (term) {
|
if (term) {
|
||||||
|
|
|
||||||
|
|
@ -195,10 +195,23 @@ Lists.mutations({
|
||||||
},
|
},
|
||||||
|
|
||||||
archive() {
|
archive() {
|
||||||
|
Cards.find({
|
||||||
|
listId: this._id,
|
||||||
|
archived: false,
|
||||||
|
}).forEach((card) => {
|
||||||
|
return card.archive();
|
||||||
|
});
|
||||||
return { $set: { archived: true } };
|
return { $set: { archived: true } };
|
||||||
},
|
},
|
||||||
|
|
||||||
restore() {
|
restore() {
|
||||||
|
cardsToRestore = Cards.find({
|
||||||
|
listId: this._id,
|
||||||
|
archived: true,
|
||||||
|
});
|
||||||
|
cardsToRestore.forEach((card) => {
|
||||||
|
card.restore();
|
||||||
|
});
|
||||||
return { $set: { archived: false } };
|
return { $set: { archived: false } };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue