1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 15:19:42 +02:00
This commit is contained in:
HarveyKandola 2018-07-28 11:43:45 -04:00
parent 743eae5aad
commit d0970c153b
8 changed files with 287 additions and 8 deletions

View file

@ -22,6 +22,8 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
spaceService: service('folder'),
localStorage: service(),
templateService: service('template'),
browserSvc: service('browser'),
documentSvc: service('document'),
session: service(),
appMeta: service(),
pinned: service(),
@ -29,21 +31,24 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
copyTemplate: true,
copyPermission: true,
copyDocument: false,
spaceSettings: computed('permissions', function() {
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
}),
deleteSpaceName: '',
hasTemplates: computed('templates', function() {
return this.get('templates.length') > 0;
}),
hasCategories: computed('categories', function() {
return this.get('categories.length') > 0;
}),
hasDocuments: computed('documents', function() {
return this.get('documents.length') > 0;
}),
emptyDocName: '',
emptyDocNameError: false,
templateDocName: '',
templateDocNameError: false,
selectedTemplate: '',
dropzone: null,
init() {
@ -71,6 +76,11 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
this.set('pinState.newName', folder.get('name'));
this.renderTooltips();
});
let cats = this.get('categories');
cats.forEach((cat) => {
cat.set('exportSelected', false);
})
},
didInsertElement() {
@ -290,6 +300,36 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
let cb = this.get('onRefresh');
cb();
}
},
onShowExport() {
this.modalOpen("#space-export-modal", {"show": true});
},
onExport() {
let spec = {
spaceId: this.get('space.id'),
data: [],
filterType: '',
}
let cats = this.get('categories');
cats.forEach((cat) => {
if (cat.get('exportSelected')) spec.data.push(cat.get('id'));
});
if (spec.data.length > 0) {
spec.filterType = 'category';
} else {
spec.filterType = 'space';
spec.data.push(this.get('space.id'));
}
this.get('documentSvc').export(spec).then((htmlExport) => {
this.get('browserSvc').downloadFile(htmlExport, this.get('space.slug') + '.html');
});
this.modalClose("#space-export-modal");
}
}
});