mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
add titleList.split to copyManyCard
This commit is contained in:
parent
326b4c5350
commit
9705118ca2
1 changed files with 28 additions and 23 deletions
|
|
@ -307,41 +307,46 @@ Template.copyManyCardPopup.events({
|
||||||
const list = Lists.findOne(card.listId);
|
const list = Lists.findOne(card.listId);
|
||||||
card.boardId = list.boardId;
|
card.boardId = list.boardId;
|
||||||
const textarea = $(evt.currentTarget).parents('.content').find('textarea');
|
const textarea = $(evt.currentTarget).parents('.content').find('textarea');
|
||||||
const title = 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(this._id).cards().count();
|
||||||
|
|
||||||
if (title) {
|
if (titleEntry) {
|
||||||
card.title = title;
|
var title, titleList;
|
||||||
card.coverId = '';
|
|
||||||
const _id = Cards.insert(card);
|
for (let title of titleList.split(",") {
|
||||||
// In case the filter is active we need to add the newly inserted card in
|
|
||||||
|
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
|
// the list of exceptions -- cards that are not filtered. Otherwise the
|
||||||
// card will disappear instantly.
|
// card will disappear instantly.
|
||||||
// See https://github.com/wekan/wekan/issues/80
|
// See https://github.com/wekan/wekan/issues/80
|
||||||
Filter.addException(_id);
|
Filter.addException(_id);
|
||||||
|
|
||||||
// copy checklists
|
// copy checklists
|
||||||
let cursor = Checklists.find({cardId: oldId});
|
let cursor = Checklists.find({cardId: oldId});
|
||||||
cursor.forEach(function() {
|
cursor.forEach(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
const checklist = arguments[0];
|
const checklist = arguments[0];
|
||||||
checklist.cardId = _id;
|
checklist.cardId = _id;
|
||||||
checklist._id = null;
|
checklist._id = null;
|
||||||
Checklists.insert(checklist);
|
Checklists.insert(checklist);
|
||||||
});
|
});
|
||||||
|
|
||||||
// copy card comments
|
// copy card comments
|
||||||
cursor = CardComments.find({cardId: oldId});
|
cursor = CardComments.find({cardId: oldId});
|
||||||
cursor.forEach(function () {
|
cursor.forEach(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
const comment = arguments[0];
|
const comment = arguments[0];
|
||||||
comment.cardId = _id;
|
comment.cardId = _id;
|
||||||
comment._id = null;
|
comment._id = null;
|
||||||
CardComments.insert(comment);
|
CardComments.insert(comment);
|
||||||
});
|
});
|
||||||
Popup.close();
|
Popup.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue