From 05f5bed4d0b90e3d8527e2cc9e6ae01ff81bc286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Tue, 12 Sep 2023 17:46:09 +0000 Subject: [PATCH] Advent22.name_door --- ui/src/components/Calendar.vue | 4 ++-- ui/src/components/CalendarAssistant.vue | 4 +++- ui/src/plugins/advent22.ts | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ui/src/components/Calendar.vue b/ui/src/components/Calendar.vue index a9ef7ed..686a6d0 100644 --- a/ui/src/components/Calendar.vue +++ b/ui/src/components/Calendar.vue @@ -51,7 +51,7 @@ export default class extends Vue { }; public door_hover(day: number) { - this.figure_caption = `Türchen ${day}`; + this.figure_caption = this.$advent22.name_door(day); } public door_unhover() { @@ -63,7 +63,7 @@ export default class extends Vue { } public door_success(day: number, image_src: string) { - this.$refs.multi_modal.show_image(image_src, `Türchen ${day}`); + this.$refs.multi_modal.show_image(image_src, this.$advent22.name_door(day)); } public door_failure(msg: string) { diff --git a/ui/src/components/CalendarAssistant.vue b/ui/src/components/CalendarAssistant.vue index 0287aa3..541ee37 100644 --- a/ui/src/components/CalendarAssistant.vue +++ b/ui/src/components/CalendarAssistant.vue @@ -91,7 +91,9 @@ export default class extends Vue { this.$advent22 .api_get_blob(`images/${day}`) - .then((data) => this.$refs.multi_modal.show_image(data, `Türchen ${day}`)) + .then((data) => + this.$refs.multi_modal.show_image(data, this.$advent22.name_door(day)), + ) .catch(() => this.$refs.multi_modal.set_active(false)); } } diff --git a/ui/src/plugins/advent22.ts b/ui/src/plugins/advent22.ts index c9a1b71..0ee1087 100644 --- a/ui/src/plugins/advent22.ts +++ b/ui/src/plugins/advent22.ts @@ -24,6 +24,18 @@ export class Advent22 { return `//${window.location.hostname}:8000/api`; } + public name_door(day: number): string { + return `Türchen ${day}`; + } + + public set_api_auth(username: string, password: string) { + this.api_auth = { username: username, password: password }; + } + + public clear_api_auth() { + this.api_auth = { username: "", password: "" }; + } + public api_url(): string; public api_url(endpoint: string): string; public api_url(endpoint?: string): string { @@ -38,14 +50,6 @@ export class Advent22 { return `${this.api_baseurl}/${endpoint}`; } - public clear_api_auth() { - this.api_auth = { username: "", password: "" }; - } - - public set_api_auth(username: string, password: string) { - this.api_auth = { username: username, password: password }; - } - private _api_get(endpoint: string): Promise; private _api_get(endpoint: string, responseType: ResponseType): Promise; private _api_get(