From d0063699f031706860689679d4ecf8651b545af1 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Tue, 25 Feb 2020 17:38:07 +0100 Subject: viewer: set page title GitHub: Resolves #95 --- viewer/src/components/LdTitle.vue | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 viewer/src/components/LdTitle.vue (limited to 'viewer/src/components/LdTitle.vue') diff --git a/viewer/src/components/LdTitle.vue b/viewer/src/components/LdTitle.vue new file mode 100644 index 0000000..47e0729 --- /dev/null +++ b/viewer/src/components/LdTitle.vue @@ -0,0 +1,44 @@ + + + -- cgit v1.2.3 From fd8064319e352a0083c9e282125e658a44e4dabb Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Thu, 27 Feb 2020 22:30:58 +0100 Subject: viewer: set page title New version, making use of the galleryTitle property, from gallery.yaml --- viewer/src/components/LdTitle.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'viewer/src/components/LdTitle.vue') diff --git a/viewer/src/components/LdTitle.vue b/viewer/src/components/LdTitle.vue index 47e0729..2614c89 100644 --- a/viewer/src/components/LdTitle.vue +++ b/viewer/src/components/LdTitle.vue @@ -22,7 +22,8 @@ import { Component, Vue, Watch, Prop } from "vue-property-decorator"; @Component export default class LdTitle extends Vue { - @Prop({ required: true }) readonly currentItemPath!: Gallery.Item[]; + @Prop({ required: true }) readonly galleryTitle!: string; + @Prop() readonly currentItem?: Gallery.Item; render() { return null; @@ -32,13 +33,14 @@ export default class LdTitle extends Vue { this.changedCurrentItemPath(); } - @Watch("currentItemPath") + @Watch("currentItem") changedCurrentItemPath() { - document.title = this.currentItemPath.map(this.extractTitle).join(" - "); + document.title = this.generateTitle(); } - extractTitle(item: Gallery.Item, idx: number): string { - return item.title || (idx === 0 ? "LdGallery" : "???"); + generateTitle(): string { + if (this.currentItem?.title) return `${this.galleryTitle} • ${this.currentItem.title}`; + return this.galleryTitle; } } -- cgit v1.2.3 From 7fa92966087ec4c1b57b054d4ccccf395ba2da75 Mon Sep 17 00:00:00 2001 From: OzoneGrif Date: Thu, 27 Feb 2020 23:35:14 +0100 Subject: Swapping gallery title and current item Co-Authored-By: Notkea --- viewer/src/components/LdTitle.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'viewer/src/components/LdTitle.vue') diff --git a/viewer/src/components/LdTitle.vue b/viewer/src/components/LdTitle.vue index 2614c89..074008d 100644 --- a/viewer/src/components/LdTitle.vue +++ b/viewer/src/components/LdTitle.vue @@ -39,7 +39,7 @@ export default class LdTitle extends Vue { } generateTitle(): string { - if (this.currentItem?.title) return `${this.galleryTitle} • ${this.currentItem.title}`; + if (this.currentItem?.title) return `${this.currentItem.title} • ${this.galleryTitle}`; return this.galleryTitle; } } -- cgit v1.2.3