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

Complete PDF section type

This commit is contained in:
Harvey Kandola 2019-04-19 11:30:40 +01:00
parent 7fde947a52
commit b5cd378302
8 changed files with 98 additions and 4 deletions

View file

@ -43,5 +43,19 @@ export default Controller.extend({
{ queryParams: { currentPageId: page.get('id')}});
});
},
onAttachmentUpload() {
this.get('documentService').getAttachments(this.get('model.document.id')).then((files) => {
this.set('model.attachments', files);
});
},
onAttachmentDelete(attachmentId) {
this.get('documentService').deleteAttachment(this.get('model.document.id'), attachmentId).then(() => {
this.get('documentService').getAttachments(this.get('model.document.id')).then((files) => {
this.set('attachments', files);
});
});
},
}
});

View file

@ -11,8 +11,8 @@
import { hash } from 'rsvp';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import Route from '@ember/routing/route';
export default Route.extend(AuthenticatedRouteMixin, {
documentService: service('document'),
@ -27,6 +27,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
permissions: this.get('folderService').get('permissions'),
links: this.modelFor('document').links,
sections: this.modelFor('document').sections,
attachments: this.modelFor('document').attachments,
page: this.get('documentService').getPage(this.modelFor('document').document.get('id'), params.page_id),
meta: this.get('documentService').getPageMeta(this.modelFor('document').document.get('id'), params.page_id)
});

View file

@ -9,6 +9,17 @@
{{/layout/master-sidebar}}
{{#layout/master-content}}
{{document/document-editor document=model.document folder=model.folder page=model.page meta=model.meta
{{document/document-editor
document=model.document
folder=model.folder
page=model.page
meta=model.meta
attachments=model.attachments
onCancel=(action "onCancel") onAction=(action "onAction")}}
{{document/section-attachment uploadLabel="Upload Attachments"
editMode=true page=model.page document=model.document
files=model.attachments
onAttachmentUpload=(action "onAttachmentUpload")
onAttachmentDelete=(action "onAttachmentDelete")}}
{{/layout/master-content}}