mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
This commit uses a new package that I need to document. It tries to solve the long-standing debate in the Meteor community about allow/deny rules versus methods (RPC). This approach gives us both the centralized security rules of allow/deny and the white-list of allowed mutations similarly to Meteor methods. The idea to have static mutation descriptions is also inspired by Facebook's Relay/GraphQL. This will allow the development of a REST API using the high-level methods instead of the MongoDB queries to do the mapping between the HTTP requests and our collections.
41 lines
1 KiB
JavaScript
41 lines
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.findOne(this.cardId).setCover(this._id);
|
|
},
|
|
'click .js-remove-cover'() {
|
|
Cards.findOne(this.cardId).unsetCover();
|
|
},
|
|
});
|
|
|
|
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();
|
|
},
|
|
});
|