wekan/client/components/cards/attachments.js
Maxime Quandalle b3851817ec Enforce a consistent ES6 coding style
Replace the old (and broken) jshint + jscsrc by eslint and configure
it to support some of the ES6 features.

The command `eslint` currently has one error which is a bug that was
discovered by its static analysis and should be fixed (usage of a
dead object).
2015-09-03 23:12:46 +02:00

41 lines
1.1 KiB
JavaScript

Template.attachmentsGalery.events({
'click .js-add-attachment': Popup.open('cardAttachments'),
'click .js-confirm-delete': Popup.afterConfirm('attachmentDelete',
() => {
Attachments.remove(this._id);
Popup.close();
}
),
// If we let this event bubble, FlowRouter will handle it and empty the page
// content, see #101.
'click .js-download'(event) {
event.stopPropagation();
},
'click .js-open-viewer'() {
// XXX Not implemented!
},
'click .js-add-cover'() {
Cards.update(this.cardId, { $set: { coverId: this._id } });
},
'click .js-remove-cover'() {
Cards.update(this.cardId, { $unset: { coverId: '' } });
},
});
Template.cardAttachmentsPopup.events({
'change .js-attach-file'(evt) {
const card = this;
FS.Utility.eachFile(evt, (f) => {
const file = new FS.File(f);
file.boardId = card.boardId;
file.cardId = card._id;
Attachments.insert(file);
Popup.close();
});
},
'click .js-computer-upload'(evt, tpl) {
tpl.find('.js-attach-file').click();
evt.preventDefault();
},
});