summaryrefslogtreecommitdiffstats
path: root/client/components/cards
diff options
context:
space:
mode:
authorNicu Tofan <nicu.tofan@gmail.com>2018-06-23 23:22:38 +0300
committerNicu Tofan <nicu.tofan@gmail.com>2018-06-26 14:32:49 +0300
commit5a023e431504f7573723db6e0d2262ecb1fc61c5 (patch)
tree46ac0e238fddc5e797eca27cc2545ad5975f86a9 /client/components/cards
parentadb7f5b2ca9e8394db314f7ff97d0d0f811c51c0 (diff)
downloadwekan-5a023e431504f7573723db6e0d2262ecb1fc61c5.tar.gz
wekan-5a023e431504f7573723db6e0d2262ecb1fc61c5.tar.bz2
wekan-5a023e431504f7573723db6e0d2262ecb1fc61c5.zip
Can add cards as subtasks
Diffstat (limited to 'client/components/cards')
-rw-r--r--client/components/cards/subtasks.js26
1 files changed, 22 insertions, 4 deletions
diff --git a/client/components/cards/subtasks.js b/client/components/cards/subtasks.js
index dc6c607f..0df5d21f 100644
--- a/client/components/cards/subtasks.js
+++ b/client/components/cards/subtasks.js
@@ -12,13 +12,31 @@ BlazeComponent.extendComponent({
const title = textarea.value.trim();
const cardId = this.currentData().cardId;
const card = Cards.findOne(cardId);
+ const sortIndex = -1;
+ const crtBoard = Boards.findOne(card.boardId);
+ const targetBoard = crtBoard.getDefaultSubtasksBoard();
+ const listId = targetBoard.getDefaultSubtasksListId();
+ const swimlaneId = Swimlanes.findOne({boardId: targetBoard._id})._id;
if (title) {
- Subtasks.insert({
- cardId,
+ const _id = Cards.insert({
title,
- sort: card.subtasks().count(),
+ parentId: cardId,
+ members: [],
+ labelIds: [],
+ customFields: [],
+ listId,
+ boardId: targetBoard._id,
+ sort: sortIndex,
+ swimlaneId,
});
+ // 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);
+
+
setTimeout(() => {
this.$('.add-subtask-item').last().click();
}, 100);
@@ -34,7 +52,7 @@ BlazeComponent.extendComponent({
deleteSubtask() {
const subtask = this.currentData().subtask;
if (subtask && subtask._id) {
- Subtasks.remove(subtask._id);
+ Cards.remove(subtask._id);
this.toggleDeleteDialog.set(false);
}
},