feat(webui): show the library name on the search drop down

* Show the library name on the search drop down

* refactor: use mustache and add prefix

Co-authored-by: Gauthier Roebroeck <gauthier.roebroeck@gmail.com>
This commit is contained in:
Ben Kuskopf 2021-05-20 19:06:05 +10:00 committed by GitHub
parent 1329d2763b
commit f85c60bd1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -26,7 +26,7 @@
<template v-slot:item="data">
<template v-if="typeof data.item !== 'object'">
<v-list-item-content v-text="data.item"></v-list-item-content>
<v-list-item-content>{{ data.item }}</v-list-item-content>
</template>
<template v-if="data.item.type === 'search'">
@ -47,7 +47,8 @@
</span>
</v-img>
<v-list-item-content>
<v-list-item-title v-text="data.item.metadata.title"/>
<v-list-item-title>{{ data.item.metadata.title }}</v-list-item-title>
<v-list-item-subtitle>{{ $t('searchbox.in_library', {library: getLibraryName(data.item)}) }}</v-list-item-subtitle>
</v-list-item-content>
</template>
@ -61,7 +62,8 @@
</v-img>
<v-list-item-content>
<v-list-item-title v-text="data.item.metadata.title"/>
<v-list-item-title>{{ data.item.metadata.title }}</v-list-item-title>
<v-list-item-subtitle>{{ $t('searchbox.in_library', {library: getLibraryName(data.item)}) }}</v-list-item-subtitle>
</v-list-item-content>
</template>
@ -72,7 +74,7 @@
class="my-1 mx-3"
/>
<v-list-item-content>
<v-list-item-title v-text="data.item.name"/>
<v-list-item-title>{{ data.item.name }}</v-list-item-title>
</v-list-item-content>
</template>
@ -83,7 +85,7 @@
class="my-1 mx-3"
/>
<v-list-item-content>
<v-list-item-title v-text="data.item.name"/>
<v-list-item-title>{{ data.item.name }}</v-list-item-title>
</v-list-item-content>
</template>
@ -169,6 +171,9 @@ export default Vue.extend({
},
},
methods: {
getLibraryName(item: BookDto | SeriesDto): string {
return this.$store.getters.getLibraryById(item.libraryId).name;
},
searchItems: debounce(async function (this: any, query: string) {
if (query) {
this.loading = true

View file

@ -545,6 +545,7 @@
"search_results_for": "Search results for \"{name}\""
},
"searchbox": {
"in_library": "in {library}",
"no_results": "No results",
"search_all": "Search all…"
},