2020-10-02 07:13:14 +00:00
|
|
|
<template>
|
2020-10-09 16:04:32 +00:00
|
|
|
<q-layout view="hHh lpr lFf">
|
2020-10-14 16:44:03 +00:00
|
|
|
<q-header
|
|
|
|
elevated
|
|
|
|
class="bg-primary text-white"
|
|
|
|
>
|
2020-10-02 07:13:14 +00:00
|
|
|
<q-toolbar>
|
2020-10-10 21:02:32 +00:00
|
|
|
<!-- Button um Navigationsleiset ein und auszublenden. Nötig bei Desktop? -->
|
2020-10-02 07:13:14 +00:00
|
|
|
<q-btn
|
|
|
|
dense
|
2020-10-09 16:04:32 +00:00
|
|
|
flat
|
2020-10-02 07:13:14 +00:00
|
|
|
round
|
|
|
|
icon="menu"
|
|
|
|
@click="leftDrawerOpen = !leftDrawerOpen"
|
2020-10-10 21:02:32 +00:00
|
|
|
v-if="!leftDrawerOpen"
|
2020-10-02 07:13:14 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<q-toolbar-title>
|
2020-10-09 16:04:32 +00:00
|
|
|
<q-avatar>
|
2020-10-10 21:02:32 +00:00
|
|
|
<img src="logo.svg" />
|
2020-10-09 16:04:32 +00:00
|
|
|
</q-avatar>
|
|
|
|
<span class="gt-xs">
|
|
|
|
Flaschengeist
|
|
|
|
</span>
|
2020-10-02 07:13:14 +00:00
|
|
|
</q-toolbar-title>
|
2020-10-10 21:02:32 +00:00
|
|
|
|
|
|
|
<!-- Hier kommen die Shortlinks hin -->
|
|
|
|
<div>
|
2020-10-14 16:44:03 +00:00
|
|
|
<q-btn
|
|
|
|
flat
|
|
|
|
round
|
|
|
|
dense
|
|
|
|
icon="sim_card"
|
|
|
|
/>
|
|
|
|
<q-btn
|
|
|
|
flat
|
|
|
|
round
|
|
|
|
dense
|
|
|
|
icon="gamepad"
|
|
|
|
/>
|
2020-10-10 21:02:32 +00:00
|
|
|
</div>
|
|
|
|
<q-btn
|
|
|
|
flat
|
|
|
|
round
|
|
|
|
dense
|
|
|
|
icon="mdi-exit-to-app"
|
|
|
|
@click="$router.push({ name: 'login' })"
|
|
|
|
/>
|
2020-10-02 07:13:14 +00:00
|
|
|
</q-toolbar>
|
|
|
|
</q-header>
|
|
|
|
|
|
|
|
<q-drawer
|
|
|
|
show-if-above
|
2020-10-09 16:04:32 +00:00
|
|
|
v-model="leftDrawerOpen"
|
|
|
|
side="left"
|
2020-10-02 07:13:14 +00:00
|
|
|
bordered
|
2020-10-10 21:02:32 +00:00
|
|
|
:mini="leftDrawerMini"
|
|
|
|
@click.capture="leftDrawerClicker"
|
2020-10-02 07:13:14 +00:00
|
|
|
>
|
2020-10-10 21:02:32 +00:00
|
|
|
<!-- Plugins -->
|
|
|
|
<q-list>
|
|
|
|
<essential-link
|
2020-10-13 21:13:42 +00:00
|
|
|
v-for="(link, index) in $flaschengeistPluginsMainLinks"
|
2020-10-13 09:27:27 +00:00
|
|
|
:key="'plugin' + index"
|
2020-10-12 21:49:05 +00:00
|
|
|
:title="link.title"
|
|
|
|
:link="link.link"
|
|
|
|
:icon="link.icon"
|
|
|
|
/>
|
2020-10-10 21:02:32 +00:00
|
|
|
</q-list>
|
|
|
|
<q-separator />
|
2020-10-09 16:04:32 +00:00
|
|
|
|
2020-10-10 21:02:32 +00:00
|
|
|
<!-- Plugin functions -->
|
2020-10-13 09:27:27 +00:00
|
|
|
<!-- <router-view name="plugin-nav" /> -->
|
|
|
|
<q-list>
|
|
|
|
<essential-link
|
|
|
|
v-for="(link, index) in pluginChildLinks"
|
|
|
|
:key="'childPlugin' + index"
|
|
|
|
:title="link.title"
|
|
|
|
:link="link.link"
|
|
|
|
:icon="link.icon"
|
|
|
|
/>
|
|
|
|
</q-list>
|
|
|
|
|
2020-10-14 16:44:03 +00:00
|
|
|
<div
|
|
|
|
class="q-mini-drawer-hide absolute"
|
|
|
|
style="top: 15px; right: -11px"
|
|
|
|
>
|
2020-10-10 21:02:32 +00:00
|
|
|
<q-btn
|
|
|
|
size="sm"
|
|
|
|
dense
|
|
|
|
round
|
|
|
|
unelevated
|
|
|
|
color="secondary"
|
|
|
|
icon="chevron_left"
|
|
|
|
@click="leftDrawerMini = true"
|
|
|
|
/>
|
|
|
|
</div>
|
2020-10-13 21:13:42 +00:00
|
|
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
<essential-link
|
|
|
|
v-for="(link, index) in links"
|
|
|
|
:key="'main' + index"
|
|
|
|
:title="link.title"
|
|
|
|
:link="link.link"
|
|
|
|
:icon="link.icon"
|
|
|
|
/>
|
2020-10-02 07:13:14 +00:00
|
|
|
</q-drawer>
|
|
|
|
|
|
|
|
<q-page-container>
|
|
|
|
<router-view />
|
|
|
|
</q-page-container>
|
|
|
|
</q-layout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-10 21:02:32 +00:00
|
|
|
import EssentialLink from 'components/navigation/EssentialLink.vue';
|
2020-10-13 09:27:27 +00:00
|
|
|
import { Screen } from 'quasar';
|
|
|
|
import { PluginMainLink } from 'boot/plugins';
|
|
|
|
import { defineComponent, ref, computed } from '@vue/composition-api';
|
2020-10-02 07:13:14 +00:00
|
|
|
|
2020-10-09 16:04:32 +00:00
|
|
|
const links = [
|
2020-10-13 09:27:27 +00:00
|
|
|
{
|
|
|
|
name: 'about',
|
2020-10-13 21:13:42 +00:00
|
|
|
title: 'Über Flaschengeist',
|
2020-10-13 09:27:27 +00:00
|
|
|
link: 'about',
|
2020-10-14 16:44:03 +00:00
|
|
|
icon: 'mdi-information',
|
|
|
|
},
|
2020-10-09 16:04:32 +00:00
|
|
|
];
|
|
|
|
|
2020-10-13 09:27:27 +00:00
|
|
|
declare module 'vue/types/vue' {
|
|
|
|
interface Vue {
|
2020-10-13 21:13:42 +00:00
|
|
|
$flaschengeistPluginsMainLinks: PluginMainLink[];
|
2020-10-13 09:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-02 07:13:14 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'MainLayout',
|
|
|
|
components: { EssentialLink },
|
2020-10-13 09:27:27 +00:00
|
|
|
setup(_, ctx) {
|
2020-10-10 21:02:32 +00:00
|
|
|
const leftDrawer = ref(false);
|
|
|
|
|
|
|
|
const leftDrawerOpen = ref(
|
|
|
|
computed({
|
|
|
|
get: () => (leftDrawer.value || Screen.gt.sm ? true : false),
|
2020-10-14 16:44:03 +00:00
|
|
|
set: (val: boolean) => (leftDrawer.value = val),
|
2020-10-10 21:02:32 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
const leftDrawerMini = ref(false);
|
|
|
|
function leftDrawerClicker() {
|
|
|
|
if (leftDrawerMini.value) {
|
|
|
|
leftDrawerMini.value = false;
|
|
|
|
}
|
|
|
|
}
|
2020-10-02 07:13:14 +00:00
|
|
|
|
2020-10-13 09:27:27 +00:00
|
|
|
const pluginChildLinks = computed(() => {
|
2020-10-14 16:44:03 +00:00
|
|
|
const link:
|
2020-10-13 09:27:27 +00:00
|
|
|
| PluginMainLink
|
2020-10-13 21:13:42 +00:00
|
|
|
| undefined = ctx.root.$flaschengeistPluginsMainLinks.find(
|
2020-10-13 09:27:27 +00:00
|
|
|
(plugin: PluginMainLink) => {
|
2020-10-13 18:17:00 +00:00
|
|
|
if (ctx.root.$route.matched.length > 1) {
|
|
|
|
return plugin.name == ctx.root.$route.matched[1].name;
|
|
|
|
}
|
2020-10-13 09:27:27 +00:00
|
|
|
}
|
|
|
|
);
|
2020-10-14 16:44:03 +00:00
|
|
|
|
|
|
|
if (link == undefined) {
|
2020-10-13 09:27:27 +00:00
|
|
|
return [];
|
|
|
|
} else {
|
2020-10-14 16:44:03 +00:00
|
|
|
return link.children;
|
2020-10-13 09:27:27 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
leftDrawerOpen,
|
|
|
|
leftDrawerMini,
|
|
|
|
leftDrawerClicker,
|
|
|
|
links,
|
|
|
|
pluginChildLinks,
|
|
|
|
};
|
2020-10-14 16:44:03 +00:00
|
|
|
},
|
2020-10-02 07:13:14 +00:00
|
|
|
});
|
|
|
|
</script>
|