diff --git a/langs/en-ca.json b/langs/en-ca.json index e5f614a..42f38a5 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -34,7 +34,13 @@ "upload": "Upload New Image", "edit-named": "Editing Image: {name}", "edit-generic": "Editing Image" - } + }, + "image-label": "Image", + "clear": "Clear", + "preview-placeholder": "Select an image to see a preview", + "name-label": "Name", + "tags-label": "Tags", + "artists-label": "Artists" } }, "settings": { diff --git a/module/apps/ImageApp.mjs b/module/apps/ImageApp.mjs index 2c6667a..e33294e 100644 --- a/module/apps/ImageApp.mjs +++ b/module/apps/ImageApp.mjs @@ -48,7 +48,7 @@ export class ImageApp extends // #region Instance Data /** The artist that is being edited, or the default artist values */ - _doc = { path: ``, tags: [], artists: [] }; + _doc = { name: ``, path: ``, tags: [], artists: [] }; get title() { if (this._docID) { @@ -88,7 +88,6 @@ export class ImageApp extends // Validate the DB hasn't been updated since opening if (!(await this.isAbleToSave())) { return }; - // Upload new image to server if (!this._docID) { const hash = this._doc.hash; @@ -148,7 +147,7 @@ export class ImageApp extends this.#artistCache.push({ value: id, label: artist.name }); }; }; - + console.log(this._doc); const ctx = { meta: { idp: this.id, @@ -179,7 +178,7 @@ export class ImageApp extends if (!file) { this.#file = null; this._docID = null; - this._doc = { path: ``, artists: [], tags: [] }; + this._doc = { path: ``, name: ``, artists: [], tags: [] }; this._updateFrame({ window: { title: this.title } }); await this.render({ parts: [`header`, `preview`, `form`] }); return; @@ -201,9 +200,10 @@ export class ImageApp extends // Temporarily blob the image so it can be displayed in-app const url = URL.createObjectURL(file); + this._doc.name = file.name.replace(`.${extension}`, ``); this._doc.path = url; this._doc.hash = hash; - await this.render({ parts: [`preview`] }); + await this.render({ parts: [`preview`, `form`] }); }; /** @this {ImageApp} */ diff --git a/templates/ImageApp/form.hbs b/templates/ImageApp/form.hbs index f69e686..d935519 100644 --- a/templates/ImageApp/form.hbs +++ b/templates/ImageApp/form.hbs @@ -1,6 +1,6 @@
{{#if docID}} - Clear + {{ localize "IT.apps.ImageApp.clear" }} {{else}} {{else}} - Select an image to see the preview + {{ localize "IT.apps.ImageApp.preview-placeholder" }} {{/if}}