refactor: hide action menu if not admin

This commit is contained in:
Gauthier Roebroeck 2020-01-06 13:45:32 +08:00
parent 30208a2340
commit dd6fd6844c
2 changed files with 25 additions and 14 deletions

View file

@ -5,6 +5,7 @@
class="sticky-bar"
:style="barStyle"
>
<!-- Go back to parent series -->
<v-btn icon
title="Go to series"
:to="{name:'browse-series', params: {seriesId: book.seriesId}}"
@ -14,7 +15,8 @@
<v-spacer/>
<v-menu offset-y>
<!-- Action menu -->
<v-menu offset-y v-if="isAdmin">
<template v-slot:activator="{ on }">
<v-btn icon v-on="on">
<v-icon>mdi-dots-vertical</v-icon>
@ -133,6 +135,9 @@ export default Vue.extend({
next()
},
computed: {
isAdmin (): boolean {
return this.$store.getters.meAdmin
},
thumbnailUrl (): string {
return `${this.baseURL}/api/v1/books/${this.bookId}/thumbnail`
},

View file

@ -5,6 +5,7 @@
class="sticky-bar"
:style="barStyle"
>
<!-- Go back to parent library -->
<v-btn icon
title="Go to library"
:to="{name:'browse-libraries', params: {libraryId: series.libraryId ? series.libraryId : 0 }}"
@ -12,6 +13,20 @@
<v-icon>mdi-arrow-left</v-icon>
</v-btn>
<!-- Action menu -->
<v-menu offset-y v-if="isAdmin">
<template v-slot:activator="{ on }">
<v-btn icon v-on="on">
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="analyze()">
<v-list-item-title>Analyze</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<v-toolbar-title>
<span v-if="series.name">{{ series.name }}</span>
<span class="ml-4 badge-count"
@ -23,6 +38,7 @@
<v-spacer/>
<!-- Sort menu -->
<v-menu offset-y>
<template v-slot:activator="{on}">
<v-btn icon v-on="on">
@ -48,19 +64,6 @@
</v-list-item>
</v-list>
</v-menu>
<v-menu offset-y>
<template v-slot:activator="{ on }">
<v-btn icon v-on="on">
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="analyze()">
<v-list-item-title>Analyze</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-toolbar>
<v-container fluid class="px-6">
@ -111,6 +114,9 @@ export default Vue.extend({
}
},
computed: {
isAdmin (): boolean {
return this.$store.getters.meAdmin
},
sortCustom (): boolean {
return this.sortActive.key !== this.sortDefault.key || this.sortActive.order !== this.sortDefault.order
},