diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-06-29 07:47:57 -0400 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-06-29 07:47:57 -0400 |
commit | b84dc20ded0375d9ab14ec05c78b737398d76b83 (patch) | |
tree | c3b91b3657299c779e941a1257df17bb0eade866 /client/components/cards/attachments.js | |
parent | 100288b3e1bce882ab9923a5bff7b5f620f33ee8 (diff) | |
parent | 3eb4d2c341b712268bd321173909e0a7b19a88c9 (diff) | |
download | wekan-b84dc20ded0375d9ab14ec05c78b737398d76b83.tar.gz wekan-b84dc20ded0375d9ab14ec05c78b737398d76b83.tar.bz2 wekan-b84dc20ded0375d9ab14ec05c78b737398d76b83.zip |
Merge branch 'linting' of https://github.com/justinr1234/wekan into justinr1234-linting
Diffstat (limited to 'client/components/cards/attachments.js')
-rw-r--r-- | client/components/cards/attachments.js | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js index e3dc143a..6b3e38a5 100644 --- a/client/components/cards/attachments.js +++ b/client/components/cards/attachments.js @@ -1,10 +1,11 @@ Template.attachmentsGalery.events({ 'click .js-add-attachment': Popup.open('cardAttachments'), - 'click .js-confirm-delete': Popup.afterConfirm('attachmentDelete', + 'click .js-confirm-delete': Popup.afterConfirm( + 'attachmentDelete', function() { Attachments.remove(this._id); Popup.close(); - } + }, ), // If we let this event bubble, FlowRouter will handle it and empty the page // content, see #101. @@ -17,8 +18,8 @@ Template.attachmentsGalery.events({ 'click .js-remove-cover'() { Cards.findOne(this.cardId).unsetCover(); }, - 'click .js-preview-image'(evt) { - Popup.open('previewAttachedImage').call(this, evt); + 'click .js-preview-image'(event) { + Popup.open('previewAttachedImage').call(this, event); // when multiple thumbnails, if click one then another very fast, // we might get a wrong width from previous img. // when popup reused, onRendered() won't be called, so we cannot get there. @@ -31,31 +32,29 @@ Template.attachmentsGalery.events({ // if the image is too large, we resize & center the popup. if (w > 300) { $('div.pop-over').css({ - width: (w + 20), + width: w + 20, position: 'absolute', - left: (window.innerWidth - w)/2, - top: (window.innerHeight - h)/2, + left: (window.innerWidth - w) / 2, + top: (window.innerHeight - h) / 2, }); } }; - const url = $(evt.currentTarget).attr('src'); - if (img.src === url && img.complete) - rePosPopup(); - else - img.onload = rePosPopup; + const url = $(event.currentTarget).attr('src'); + if (img.src === url && img.complete) rePosPopup(); + else img.onload = rePosPopup; }, }); Template.previewAttachedImagePopup.events({ - 'click .js-large-image-clicked'(){ + 'click .js-large-image-clicked'() { Popup.close(); }, }); Template.cardAttachmentsPopup.events({ - 'change .js-attach-file'(evt) { + 'change .js-attach-file'(event) { const card = this; - FS.Utility.eachFile(evt, (f) => { + FS.Utility.eachFile(event, f => { const file = new FS.File(f); if (card.isLinkedCard()) { file.boardId = Cards.findOne(card.linkedId).boardId; @@ -77,9 +76,9 @@ Template.cardAttachmentsPopup.events({ Popup.close(); }); }, - 'click .js-computer-upload'(evt, tpl) { - tpl.find('.js-attach-file').click(); - evt.preventDefault(); + 'click .js-computer-upload'(event, templateInstance) { + templateInstance.find('.js-attach-file').click(); + event.preventDefault(); }, 'click .js-upload-clipboard-image': Popup.open('previewClipboardImage'), }); @@ -88,7 +87,7 @@ let pastedResults = null; Template.previewClipboardImagePopup.onRendered(() => { // we can paste image from clipboard - $(document.body).pasteImageReader((results) => { + $(document.body).pasteImageReader(results => { if (results.dataURL.startsWith('data:image/')) { $('img.preview-clipboard-image').attr('src', results.dataURL); pastedResults = results; @@ -96,7 +95,7 @@ Template.previewClipboardImagePopup.onRendered(() => { }); // we can also drag & drop image file to it - $(document.body).dropImageReader((results) => { + $(document.body).dropImageReader(results => { if (results.dataURL.startsWith('data:image/')) { $('img.preview-clipboard-image').attr('src', results.dataURL); pastedResults = results; |