summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-23 19:00:52 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commit044126188d28a24b0df5d67cf69d081ce7790886 (patch)
tree0790c59e1512a18f56e08367a2f98aeba8ceeb8f /client
parent0fec7115451ba3b49442965c8160df4911157601 (diff)
downloadwekan-044126188d28a24b0df5d67cf69d081ce7790886.tar.gz
wekan-044126188d28a24b0df5d67cf69d081ce7790886.tar.bz2
wekan-044126188d28a24b0df5d67cf69d081ce7790886.zip
Allow card creation from template
Diffstat (limited to 'client')
-rw-r--r--client/components/lists/listBody.js35
1 files changed, 18 insertions, 17 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index e6849eb2..e84874bb 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -593,26 +593,27 @@ BlazeComponent.extendComponent({
this.term.set(evt.target.searchTerm.value);
},
'click .js-minicard'(evt) {
- // LINK CARD
- const card = Blaze.getData(evt.currentTarget);
- const _id = Cards.insert({
- title: card.title, //dummy
- listId: this.listId,
- swimlaneId: this.swimlaneId,
- boardId: this.boardId,
- sort: Lists.findOne(this.listId).cards().count(),
- type: 'cardType-linkedCard',
- linkedId: card.linkedId || card._id,
- });
+ let card = Blaze.getData(evt.currentTarget);
+ let _id = '';
+ // Common
+ card.listId = this.listId;
+ card.swimlaneId = this.swimlaneId;
+ card.boardId = this.boardId;
+ card.sort = Lists.findOne(this.listId).cards().count();
+ // From template
+ if (this.isTemplateSearch) {
+ card.type = 'cardType-card';
+ card.linkedId = '';
+ _id = card.copy();
+ } else { // Linked
+ card._id = null;
+ card.type = 'cardType-linkedCard';
+ card.linkedId = card.linkedId || card._id;
+ _id = Cards.insert(card);
+ }
Filter.addException(_id);
Popup.close();
},
}];
},
}).register('searchCardPopup');
-
-Template.searchCardPopup.helpers({
- isTemplateSearch() {
- return $(Popup._getTopStack().openerElement).hasClass('js-search-template');
- },
-});