summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/lists/listBody.jade27
-rw-r--r--client/components/lists/listBody.js43
-rw-r--r--i18n/en.i18n.json1
-rw-r--r--models/boards.js4
-rw-r--r--models/lists.js13
5 files changed, 57 insertions, 31 deletions
diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade
index bc1469a9..4d7ec158 100644
--- a/client/components/lists/listBody.jade
+++ b/client/components/lists/listBody.jade
@@ -54,6 +54,10 @@ template(name="addCardForm")
|  
| /
a.js-search {{_ 'search'}}
+ span.quiet
+ |  
+ | /
+ a.js-search-template {{_ 'template'}}
template(name="autocompleteLabelLine")
.minicard-label(class="card-label-{{colorName}}" title=labelName)
@@ -63,11 +67,9 @@ template(name="linkCardPopup")
label {{_ 'boards'}}:
.link-board-wrapper
select.js-select-boards
+ option(value="")
each boards
- if $eq _id currentBoard._id
- option(value="{{_id}}" selected) {{_ 'current'}}
- else
- option(value="{{_id}}") {{title}}
+ option(value="{{_id}}") {{title}}
input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
label {{_ 'swimlanes'}}:
@@ -90,14 +92,15 @@ template(name="linkCardPopup")
input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")
template(name="searchCardPopup")
- label {{_ 'boards'}}:
- .link-board-wrapper
- select.js-select-boards
- each boards
- if $eq _id currentBoard._id
- option(value="{{_id}}" selected) {{_ 'current'}}
- else
- option(value="{{_id}}") {{title}}
+ unless isTemplateSearch
+ label {{_ 'boards'}}:
+ .link-board-wrapper
+ select.js-select-boards
+ each boards
+ if $eq _id currentBoard._id
+ option(value="{{_id}}" selected) {{_ 'current'}}
+ else
+ option(value="{{_id}}") {{title}}
form.js-search-term-form
input(type="text" name="searchTerm" placeholder="{{_ 'search-example'}}" autofocus)
.list-body.js-perfect-scrollbar.search-card-results
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index eccef552..66d056c4 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -316,6 +316,7 @@ BlazeComponent.extendComponent({
keydown: this.pressKey,
'click .js-link': Popup.open('linkCard'),
'click .js-search': Popup.open('searchCard'),
+ 'click .js-search-template': Popup.open('searchCard'),
}];
},
@@ -390,17 +391,7 @@ BlazeComponent.extendComponent({
BlazeComponent.extendComponent({
onCreated() {
- // Prefetch first non-current board id
- 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.selectedBoardId = new ReactiveVar('');
this.selectedSwimlaneId = new ReactiveVar('');
this.selectedListId = new ReactiveVar('');
@@ -426,6 +417,7 @@ BlazeComponent.extendComponent({
archived: false,
'members.userId': Meteor.userId(),
_id: {$ne: Session.get('currentBoard')},
+ type: 'board',
}, {
sort: ['title'],
});
@@ -433,7 +425,7 @@ BlazeComponent.extendComponent({
},
swimlanes() {
- if (!this.selectedBoardId) {
+ if (!this.selectedBoardId.get()) {
return [];
}
const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()});
@@ -443,7 +435,7 @@ BlazeComponent.extendComponent({
},
lists() {
- if (!this.selectedBoardId) {
+ if (!this.selectedBoardId.get()) {
return [];
}
const lists = Lists.find({boardId: this.selectedBoardId.get()});
@@ -531,12 +523,18 @@ BlazeComponent.extendComponent({
},
onCreated() {
- // Prefetch first non-current board id
- let board = Boards.findOne({
- archived: false,
- 'members.userId': Meteor.userId(),
- _id: {$ne: Session.get('currentBoard')},
- });
+ const isTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-search-template');
+ let board = {};
+ if (isTemplateSearch) {
+ board = Boards.findOne(Meteor.user().profile.templatesBoardId);
+ } else {
+ // Prefetch first non-current board id
+ board = Boards.findOne({
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ _id: {$ne: Session.get('currentBoard')},
+ });
+ }
if (!board) {
Popup.close();
return;
@@ -568,6 +566,7 @@ BlazeComponent.extendComponent({
archived: false,
'members.userId': Meteor.userId(),
_id: {$ne: Session.get('currentBoard')},
+ type: 'board',
}, {
sort: ['title'],
});
@@ -610,3 +609,9 @@ BlazeComponent.extendComponent({
}];
},
}).register('searchCardPopup');
+
+Template.searchCardPopup.helpers({
+ isTemplateSearch() {
+ return $(Popup._getTopStack().openerElement).hasClass('js-search-template');
+ },
+});
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 3c6effd6..94666c16 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -92,6 +92,7 @@
"restore-board": "Restore Board",
"no-archived-boards": "No Boards in Archive.",
"archives": "Archive",
+ "template": "Template",
"templates": "Templates",
"assign-member": "Assign member",
"attached": "attached",
diff --git a/models/boards.js b/models/boards.js
index 7328899e..c17c7351 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -470,6 +470,10 @@ Boards.helpers({
if (excludeLinked) {
query.linkedId = null;
}
+ if (this.isTemplatesBoard()) {
+ query.type = 'template-card';
+ query.archived = false;
+ }
const projection = { limit: 10, sort: { createdAt: -1 } };
if (term) {
diff --git a/models/lists.js b/models/lists.js
index a0b882bc..236432cc 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -195,10 +195,23 @@ Lists.mutations({
},
archive() {
+ Cards.find({
+ listId: this._id,
+ archived: false,
+ }).forEach((card) => {
+ return card.archive();
+ });
return { $set: { archived: true } };
},
restore() {
+ cardsToRestore = Cards.find({
+ listId: this._id,
+ archived: true,
+ });
+ cardsToRestore.forEach((card) => {
+ card.restore();
+ });
return { $set: { archived: false } };
},