Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
fix: some menu madness
Browse files Browse the repository at this point in the history
  • Loading branch information
villetakanen committed Dec 8, 2021
1 parent 1599659 commit fc10832
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/components/page/PageToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import Header from '../layout/Header.vue'
import ViewTitle from '../layout/ViewTitle.vue'
import SpacerDiv from '../layout/SpacerDiv.vue'
import ShareButton from '../actions/ShareButton.vue'
import { useAuth } from '@/state/authz'
import { useMeta } from '@/state/meta'
export default defineComponent({
components: { MaterialMenu, Dialog, Textfield, Button, Header, ViewTitle, SpacerDiv, ShareButton },
Expand All @@ -66,11 +68,13 @@ export default defineComponent({
}
},
setup () {
const { site, hasAdmin } = useSite()
const { site } = useSite()
const { deletePage } = usePage()
const copyLink = useCopyLinkToClipboard()
const i18n = useI18n()
const { reroute } = useUxActions()
const { user } = useAuth()
const { admins } = useMeta()
const toggleDelete = ref(false)
const deleteConfirm = ref('')
Expand All @@ -88,13 +92,35 @@ export default defineComponent({
const menu = computed(() => {
const menuItems = new Array<MenuItem>()
if (hasAdmin()) {
if (site.value.hasEditor(user.value.uid)) {
menuItems.push({
text: i18n.t('action.delete'),
icon: 'delete',
action: openDeleteDialog
})
}
menuItems.push({
text: '---'
})
if (site.value.usePlayers) {
menuItems.push({
text: i18n.t('site.keeper.title'),
icon: 'keeper',
to: '/site/' + site.value.id + '/keeper'
})
}
if (site.value.hasOwner(user.value.uid)) {
menuItems.push({
text: i18n.t('site.meta.title'),
icon: 'equalizer',
to: '/site/' + site.value.id + '/meta'
})
menuItems.push({
text: i18n.t('site.settings.title'),
icon: 'settings',
to: '/site/' + site.value.id + '/settings'
})
}
return menuItems
})
Expand Down

0 comments on commit fc10832

Please sign in to comment.