From 74a01691e3490675d78cc4f24b3b99959e702c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Wed, 18 Apr 2018 01:35:46 -0300 Subject: Add two way binding of activities, comments, and attachments --- client/components/activities/comments.js | 11 +++++++++-- client/components/cards/attachments.js | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'client/components') diff --git a/client/components/activities/comments.js b/client/components/activities/comments.js index 9b6aedd6..137b6872 100644 --- a/client/components/activities/comments.js +++ b/client/components/activities/comments.js @@ -21,11 +21,18 @@ BlazeComponent.extendComponent({ 'submit .js-new-comment-form'(evt) { const input = this.getInput(); const text = input.val().trim(); + const card = this.currentData(); + let boardId = card.boardId; + let cardId = card._id; + if (card.isImportedCard()) { + boardId = Cards.findOne(card.importedId).boardId; + cardId = card.importedId; + } if (text) { CardComments.insert({ text, - boardId: this.currentData().boardId, - cardId: this.currentData()._id, + boardId, + cardId, }); resetCommentInput(input); Tracker.flush(); diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js index bc7d3979..1a4d5bb6 100644 --- a/client/components/cards/attachments.js +++ b/client/components/cards/attachments.js @@ -57,8 +57,13 @@ Template.cardAttachmentsPopup.events({ const card = this; FS.Utility.eachFile(evt, (f) => { const file = new FS.File(f); - file.boardId = card.boardId; - file.cardId = card._id; + if (card.isImportedCard()) { + file.boardId = Cards.findOne(card.importedId).boardId; + file.cardId = card.importedId; + } else { + file.boardId = card.boardId; + file.cardId = card._id; + } file.userId = Meteor.userId(); const attachment = Attachments.insert(file); -- cgit v1.2.3-1-g7c22