summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2018-04-15 23:50:09 -0300
committerAndrés Manelli <andresmanelli@gmail.com>2018-04-16 00:19:03 -0300
commiteae4bb2d372c683c4abf7f2f3bee91783e9e8111 (patch)
tree9912c789b5e5c500fc7920e07cc2e6e89a2ae632 /client
parent31584e849c2b1eeffc8be37a6da8902bb251ff52 (diff)
downloadwekan-eae4bb2d372c683c4abf7f2f3bee91783e9e8111.tar.gz
wekan-eae4bb2d372c683c4abf7f2f3bee91783e9e8111.tar.bz2
wekan-eae4bb2d372c683c4abf7f2f3bee91783e9e8111.zip
Fix #1565
Diffstat (limited to 'client')
-rw-r--r--client/components/cards/cardDetails.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 421cef53..1b98f2af 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -343,9 +343,16 @@ Template.copyCardPopup.events({
cursor.forEach(function() {
'use strict';
const checklist = arguments[0];
+ const checklistId = checklist._id;
checklist.cardId = _id;
checklist._id = null;
- Checklists.insert(checklist);
+ const newChecklistId = Checklists.insert(checklist);
+ ChecklistItems.find({checklistId: checklistId}).forEach(function(item) {
+ item._id = null;
+ item.checklistId = newChecklistId;
+ item.cardId = _id;
+ ChecklistItems.insert(item);
+ });
});
// copy card comments
@@ -363,17 +370,20 @@ Template.copyCardPopup.events({
});
Template.copyChecklistToManyCardsPopup.events({
- 'click .js-select-list' (evt) {
+ 'click .js-done' (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 lSelect = $('.js-select-lists')[0];
+ card.listId = lSelect.options[lSelect.selectedIndex].value;
+ const slSelect = $('.js-select-swimlanes')[0];
+ card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
+ const bSelect = $('.js-select-boards')[0];
+ card.boardId = bSelect.options[bSelect.selectedIndex].value;
+ const textarea = $('#copy-card-title');
const titleEntry = textarea.val().trim();
// insert new card to the bottom of new list
- card.sort = Lists.findOne(this._id).cards().count();
+ card.sort = Lists.findOne(card.listId).cards().count();
if (titleEntry) {
const titleList = JSON.parse(titleEntry);
@@ -394,9 +404,16 @@ Template.copyChecklistToManyCardsPopup.events({
cursor.forEach(function() {
'use strict';
const checklist = arguments[0];
+ const checklistId = checklist._id;
checklist.cardId = _id;
checklist._id = null;
- Checklists.insert(checklist);
+ const newChecklistId = Checklists.insert(checklist);
+ ChecklistItems.find({checklistId: checklistId}).forEach(function(item) {
+ item._id = null;
+ item.checklistId = newChecklistId;
+ item.cardId = _id;
+ ChecklistItems.insert(item);
+ });
});
// copy card comments