mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Fix #1565
This commit is contained in:
parent
31584e849c
commit
eae4bb2d37
1 changed files with 25 additions and 8 deletions
|
|
@ -343,9 +343,16 @@ Template.copyCardPopup.events({
|
||||||
cursor.forEach(function() {
|
cursor.forEach(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
const checklist = arguments[0];
|
const checklist = arguments[0];
|
||||||
|
const checklistId = checklist._id;
|
||||||
checklist.cardId = _id;
|
checklist.cardId = _id;
|
||||||
checklist._id = null;
|
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
|
// copy card comments
|
||||||
|
|
@ -363,17 +370,20 @@ Template.copyCardPopup.events({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.copyChecklistToManyCardsPopup.events({
|
Template.copyChecklistToManyCardsPopup.events({
|
||||||
'click .js-select-list' (evt) {
|
'click .js-done' (evt) {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Cards.findOne(Session.get('currentCard'));
|
||||||
const oldId = card._id;
|
const oldId = card._id;
|
||||||
card._id = null;
|
card._id = null;
|
||||||
card.listId = this._id;
|
const lSelect = $('.js-select-lists')[0];
|
||||||
const list = Lists.findOne(card.listId);
|
card.listId = lSelect.options[lSelect.selectedIndex].value;
|
||||||
card.boardId = list.boardId;
|
const slSelect = $('.js-select-swimlanes')[0];
|
||||||
const textarea = $(evt.currentTarget).parents('.content').find('textarea');
|
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();
|
const titleEntry = textarea.val().trim();
|
||||||
// insert new card to the bottom of new list
|
// 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) {
|
if (titleEntry) {
|
||||||
const titleList = JSON.parse(titleEntry);
|
const titleList = JSON.parse(titleEntry);
|
||||||
|
|
@ -394,9 +404,16 @@ Template.copyChecklistToManyCardsPopup.events({
|
||||||
cursor.forEach(function() {
|
cursor.forEach(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
const checklist = arguments[0];
|
const checklist = arguments[0];
|
||||||
|
const checklistId = checklist._id;
|
||||||
checklist.cardId = _id;
|
checklist.cardId = _id;
|
||||||
checklist._id = null;
|
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
|
// copy card comments
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue