Attachment upload from card done, need to fix download link

This commit is contained in:
Romulus Urakagi Tsai 2019-11-20 10:40:09 +00:00
parent 05c53ca01d
commit 4dcdec0084
9 changed files with 49 additions and 27 deletions

View file

@ -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) {