diff --git a/addon/components/document-details.hbs b/addon/components/document-details.hbs index 6eeecb62..edf8d832 100644 --- a/addon/components/document-details.hbs +++ b/addon/components/document-details.hbs @@ -77,6 +77,49 @@ +

+ {{#if this.editDescription}} + +

+ + +
+ {{else}} + {{#if @document.description}} + + {{@document.description}} + + {{else}} + + {{t "alexandria.document-details.add-description"}} + + {{/if}} + {{/if}} +

+

{{t diff --git a/addon/components/document-details.js b/addon/components/document-details.js index bd2927fc..b6b4d19e 100644 --- a/addon/components/document-details.js +++ b/addon/components/document-details.js @@ -11,6 +11,7 @@ export default class DocumentDetailsComponent extends DocumentCard { @service tags; @tracked editTitle = false; + @tracked editDescription = false; @tracked validTitle = true; @tracked matchingTags = []; @@ -23,15 +24,20 @@ export default class DocumentDetailsComponent extends DocumentCard { this.args.document.title = title; } + @action updateDocumentDescription({ target: { value: description } }) { + this.args.document.description = description; + } + @action resetState() { this.editTitle = false; this.validTitle = true; + this.editDescription = false; } @restartableTask *saveDocument() { try { yield this.args.document.save(); - this.editTitle = false; + this.resetState(); this.notification.success(this.intl.t("alexandria.success.update")); } catch (error) { this.notification.danger(this.intl.t("alexandria.errors.update")); diff --git a/translations/de.yaml b/translations/de.yaml index 5ae82221..f7a079d3 100644 --- a/translations/de.yaml +++ b/translations/de.yaml @@ -49,6 +49,7 @@ alexandria: created-at: "Erstellt am {date}" name-placeholder: "Name..." version-history: "Versionsgeschichte" + add-description: "Beschreibung hinzufügen" replace: "Ersetzen" tags: title: "Tags" diff --git a/translations/en.yaml b/translations/en.yaml index d9d7ec73..45b8215a 100644 --- a/translations/en.yaml +++ b/translations/en.yaml @@ -49,6 +49,7 @@ alexandria: created-at: "Created on {date}" name-placeholder: "Name..." version-history: "Version history" + add-description: "Add description" replace: "Replace" tags: title: "Tags"