From 4dcdec0084414e7dde9e630add01ecd2865bd941 Mon Sep 17 00:00:00 2001 From: Romulus Urakagi Tsai Date: Wed, 20 Nov 2019 10:40:09 +0000 Subject: Attachment upload from card done, need to fix download link --- client/components/cards/attachments.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'client/components/cards/attachments.js') diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js index 604dc078..f24a7f82 100644 --- a/client/components/cards/attachments.js +++ b/client/components/cards/attachments.js @@ -45,18 +45,31 @@ Template.attachmentsGalery.events({ }, }); +Template.attachmentsGalery.helpers({ + url() { + return Attachments.link(this); + } +}); + Template.previewAttachedImagePopup.events({ 'click .js-large-image-clicked'() { Popup.close(); }, }); +Template.previewAttachedImagePopup.helpers({ + url() { + return Attachments.link(this); + } +}); + Template.cardAttachmentsPopup.events({ 'change .js-attach-file'(event) { const card = this; const processFile = f => { Utils.processUploadedAttachment(card, f, attachment => { - if (attachment && attachment._id && attachment.isImage()) { + console.log('attachment', attachment); + if (attachment && attachment._id && attachment.isImage) { card.setCover(attachment._id); } Popup.close(); @@ -152,13 +165,14 @@ Template.previewClipboardImagePopup.events({ const settings = { file: results.file, streams: 'dynamic', - chunkSize: 'dynamic' + chunkSize: 'dynamic', }; if (!results.name) { // if no filename, it's from clipboard. then we give it a name, with ext name from MIME type // FIXME: Check this behavior if (typeof results.file.type === 'string') { - settings.fileName = new Date().getTime() + results.file.type.replace('.+/', ''); + settings.fileName = + new Date().getTime() + results.file.type.replace('.+/', ''); } } settings.meta = {}; @@ -166,8 +180,7 @@ Template.previewClipboardImagePopup.events({ settings.meta.boardId = card.boardId; settings.meta.cardId = card._id; settings.meta.userId = Meteor.userId(); - console.log('settings', settings); - const attachment = Attachments.insert(settings, false); + const attachment = Attachments.insert(settings); // TODO: Check image cover behavior if (attachment && attachment._id && attachment.isImage) { -- cgit v1.2.3-1-g7c22