From 801898c7c584de8c83ee7210256d1b70090c47d8 Mon Sep 17 00:00:00 2001 From: yelinz Date: Tue, 20 Feb 2024 18:32:26 +0100 Subject: [PATCH] feat: add button to convert to pdf Integrates backend endpoint to convert docx, odt to pdf --- README.md | 7 ++++ addon/components/document-view.hbs | 7 ++-- addon/components/document-view.js | 3 +- addon/components/documents-side-panel.hbs | 5 ++- addon/components/single-document-details.hbs | 14 +++++++- addon/components/single-document-details.js | 34 ++++++++++++++++++-- addon/models/file.js | 3 +- addon/services/alexandria-config.js | 6 ++++ translations/en.yaml | 3 ++ 9 files changed, 73 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 075ed166f..e6818a3a4 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,13 @@ module.exports = function () { }; ``` +### Others + +- `enablePDFConversion`: Set to `true` to enable docx/odt to pdf conversion. Make sure the backend is enabled aswell. +- `namespace`: Set to API namespace +- `zipDownloadHost`: Set if the ZIP download is different +- `zipDownloadNamespace`: Set if the ZIP download is namespaced + ## Contributing See the [Contributing](CONTRIBUTING.md) guide for details. diff --git a/addon/components/document-view.hbs b/addon/components/document-view.hbs index 077cde6af..b7a2be1c6 100644 --- a/addon/components/document-view.hbs +++ b/addon/components/document-view.hbs @@ -8,7 +8,7 @@
@@ -86,7 +86,10 @@ {{/if}}
- +
[ this.sort, this.sortDirection, @@ -210,7 +211,7 @@ export default class DocumentViewComponent extends Component { } @action - afterUpload() { + refreshDocumentList() { this.uploadedDocuments++; } diff --git a/addon/components/documents-side-panel.hbs b/addon/components/documents-side-panel.hbs index a08a36f33..fd7b294f2 100644 --- a/addon/components/documents-side-panel.hbs +++ b/addon/components/documents-side-panel.hbs @@ -8,7 +8,10 @@
{{#if (eq @selectedDocuments.length 1)}} - + {{else}}
-
+
+ {{#if this.displayConvertButton}} +
+ + {{t "alexandria.document-details.convert"}} + +
+ {{/if}} +