feat(webui): add back button on book view

* Add a back to arrow to the navigation on the book page to return to the books series

* Update BrowseBook.vue

* feat: conditional back button depending on context

also uses proper tooltip instead of title

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

View file

@ -163,6 +163,8 @@
"filter_no_matches": "The active filter has no matches", "filter_no_matches": "The active filter has no matches",
"genre": "Genre", "genre": "Genre",
"go_to_library": "Go to library", "go_to_library": "Go to library",
"go_to_series": "Go to series",
"go_to_readlist": "Go to read list",
"locale_name": "English", "locale_name": "English",
"locale_rtl": "false", "locale_rtl": "false",
"n_selected": "{count} selected", "n_selected": "{count} selected",

View file

@ -1,6 +1,20 @@
<template> <template>
<div v-if="!$_.isEmpty(book)"> <div v-if="!$_.isEmpty(book)">
<toolbar-sticky> <toolbar-sticky>
<v-tooltip bottom :disabled="!isAdmin">
<template v-slot:activator="{ on }">
<v-btn icon
v-on="on"
:to="parent.route"
>
<v-icon v-if="$vuetify.rtl">mdi-arrow-right</v-icon>
<v-icon v-else>mdi-arrow-left</v-icon>
</v-btn>
</template>
<span v-if="contextReadList">{{ $t('common.go_to_readlist') }}</span>
<span v-else>{{ $t('common.go_to_series') }}</span>
</v-tooltip>
<!-- Action menu --> <!-- Action menu -->
<book-actions-menu v-if="book" <book-actions-menu v-if="book"
:book="book" :book="book"
@ -405,6 +419,18 @@ export default Vue.extend({
mediaComment(): string { mediaComment(): string {
return convertErrorCodes(this.book.media.comment) return convertErrorCodes(this.book.media.comment)
}, },
parent(): object {
if (this.contextReadList)
return {
name: this.contextName,
route: {name: 'browse-readlist', params: {readListId: this.context.id}},
}
else
return {
name: this.series.name,
route: {name: 'browse-series', params: {seriesId: this.book.seriesId}},
}
},
}, },
methods: { methods: {
libraryDeleted(event: EventLibraryDeleted) { libraryDeleted(event: EventLibraryDeleted) {

View file

@ -2,12 +2,17 @@
<div v-if="!$_.isEmpty(series)"> <div v-if="!$_.isEmpty(series)">
<toolbar-sticky v-if="selectedBooks.length === 0"> <toolbar-sticky v-if="selectedBooks.length === 0">
<!-- Go back to parent library --> <!-- Go back to parent library -->
<v-btn icon <v-tooltip bottom :disabled="!isAdmin">
:title="$t('common.go_to_library')" <template v-slot:activator="{ on }">
:to="{name:'browse-libraries', params: {libraryId: series.libraryId }}" <v-btn icon
> v-on="on"
<rtl-icon icon="mdi-arrow-left" rtl="mdi-arrow-right"/> :to="{name:'browse-libraries', params: {libraryId: series.libraryId }}"
</v-btn> >
<rtl-icon icon="mdi-arrow-left" rtl="mdi-arrow-right"/>
</v-btn>
</template>
<span>{{ $t('common.go_to_library') }}</span>
</v-tooltip>
<series-actions-menu v-if="series" <series-actions-menu v-if="series"
:series="series" :series="series"