summaryrefslogtreecommitdiffstats
path: root/client/components
diff options
context:
space:
mode:
authorErik Turk <erik.turk@ontera.ca>2018-02-05 11:11:41 -0500
committerErik Turk <erik.turk@ontera.ca>2018-02-05 11:11:41 -0500
commit60c6f4f5af38712641f90fa139511106f985b078 (patch)
treeaf49046909d9c70c8588ae9296ae14f8f0484d6c /client/components
parent3c1cd85f6f961ec19832901a059b072b44d89dc4 (diff)
downloadwekan-60c6f4f5af38712641f90fa139511106f985b078.tar.gz
wekan-60c6f4f5af38712641f90fa139511106f985b078.tar.bz2
wekan-60c6f4f5af38712641f90fa139511106f985b078.zip
added Popup
Diffstat (limited to 'client/components')
-rw-r--r--client/components/cards/cardDetails.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 3ae6327b..a2168b29 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -297,6 +297,55 @@ Template.copyCardPopup.events({
},
});
+
+Template.copyManyCardPopup.events({
+ 'click .js-select-list' (evt) {
+ const card = Cards.findOne(Session.get('currentCard'));
+ const oldId = card._id;
+ card._id = null;
+ card.listId = this._id;
+ const list = Lists.findOne(card.listId);
+ card.boardId = list.boardId;
+ const textarea = $(evt.currentTarget).parents('.content').find('textarea');
+ const title = textarea.val().trim();
+ // insert new card to the bottom of new list
+ card.sort = Lists.findOne(this._id).cards().count();
+
+ if (title) {
+ card.title = title;
+ card.coverId = '';
+ const _id = Cards.insert(card);
+ // In case the filter is active we need to add the newly inserted card in
+ // the list of exceptions -- cards that are not filtered. Otherwise the
+ // card will disappear instantly.
+ // See https://github.com/wekan/wekan/issues/80
+ Filter.addException(_id);
+
+ // copy checklists
+ let cursor = Checklists.find({cardId: oldId});
+ cursor.forEach(function() {
+ 'use strict';
+ const checklist = arguments[0];
+ checklist.cardId = _id;
+ checklist._id = null;
+ Checklists.insert(checklist);
+ });
+
+ // copy card comments
+ cursor = CardComments.find({cardId: oldId});
+ cursor.forEach(function () {
+ 'use strict';
+ const comment = arguments[0];
+ comment.cardId = _id;
+ comment._id = null;
+ CardComments.insert(comment);
+ });
+ Popup.close();
+ }
+ },
+});
+
+
Template.cardMorePopup.events({
'click .js-copy-card-link-to-clipboard' () {
// Clipboard code from: