1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 07:09:43 +02:00

Provide per section attachments

Upload and delete attachments on a per section basis.
This commit is contained in:
Harvey Kandola 2019-04-18 13:31:48 +01:00
parent 166aeba09b
commit 61d0086337
13 changed files with 248 additions and 116 deletions

View file

@ -222,6 +222,20 @@ export default Controller.extend(Notifier, {
this.get('router').transitionTo('document.settings', {queryParams: {tab: 'general'}});
},
onAttachmentUpload() {
this.get('documentService').getAttachments(this.get('document.id')).then((files) => {
this.set('attachments', files);
});
},
onAttachmentDelete(attachmentId) {
this.get('documentService').deleteAttachment(this.get('document.id'), attachmentId).then(() => {
this.get('documentService').getAttachments(this.get('document.id')).then((files) => {
this.set('attachments', files);
});
});
},
refresh(reloadPage) {
return new EmberPromise((resolve) => {
this.get('documentService').fetchDocumentData(this.get('document.id')).then((data) => {
@ -232,6 +246,7 @@ export default Controller.extend(Notifier, {
this.set('roles', data.roles);
this.set('links', data.links);
this.set('versions', data.versions);
this.set('attachments', data.attachments);
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((data) => {
this.set('pages', data);