mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-29 18:19:41 +02:00
- Static pages have their own titles - The name of the recipe is displayed when viewing it
110 lines
No EOL
2.4 KiB
Vue
110 lines
No EOL
2.4 KiB
Vue
<template>
|
|
<div>
|
|
<v-btn
|
|
class="mt-9 ml-n1"
|
|
fixed
|
|
left
|
|
bottom
|
|
fab
|
|
small
|
|
color="primary"
|
|
@click="showSidebar = !showSidebar"
|
|
>
|
|
<v-icon>mdi-tag</v-icon></v-btn
|
|
>
|
|
|
|
<v-navigation-drawer
|
|
:value="mobile ? showSidebar : true"
|
|
v-model="showSidebar"
|
|
width="175px"
|
|
clipped
|
|
app
|
|
>
|
|
<v-list nav dense>
|
|
<v-list-item v-for="nav in links" :key="nav.title" link :to="nav.to">
|
|
<v-list-item-icon>
|
|
<v-icon>{{ nav.icon }}</v-icon>
|
|
</v-list-item-icon>
|
|
<v-list-item-title>{{ nav.title | titleCase }}</v-list-item-title>
|
|
</v-list-item>
|
|
</v-list>
|
|
</v-navigation-drawer>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { api } from "@/api";
|
|
export default {
|
|
data() {
|
|
return {
|
|
showSidebar: false,
|
|
mobile: false,
|
|
links: [],
|
|
baseLinks: [
|
|
{
|
|
icon: "mdi-home",
|
|
to: "/",
|
|
title: this.$t("page.home-page"),
|
|
},
|
|
{
|
|
icon: "mdi-view-module",
|
|
to: "/recipes/all",
|
|
title: this.$t("page.all-recipes"),
|
|
},
|
|
{
|
|
icon: "mdi-magnify",
|
|
to: "/search",
|
|
title: this.$t('search.search'),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
mounted() {
|
|
this.buildSidebar();
|
|
this.mobile = this.viewScale();
|
|
this.showSidebar = !this.viewScale();
|
|
},
|
|
|
|
methods: {
|
|
async buildSidebar() {
|
|
this.links = [];
|
|
this.links.push(...this.baseLinks);
|
|
const pages = await api.siteSettings.getPages();
|
|
if(pages.length > 0) {
|
|
pages.sort((a, b) => a.position - b.position);
|
|
pages.forEach(async element => {
|
|
this.links.push({
|
|
title: element.name,
|
|
to: `/pages/${element.slug}`,
|
|
icon: "mdi-tag",
|
|
});
|
|
});
|
|
}
|
|
else {
|
|
const categories = await api.categories.getAll();
|
|
categories.forEach(async element => {
|
|
this.links.push({
|
|
title: element.name,
|
|
to: `/recipes/category/${element.slug}`,
|
|
icon: "mdi-tag",
|
|
});
|
|
});
|
|
}
|
|
|
|
},
|
|
viewScale() {
|
|
switch (this.$vuetify.breakpoint.name) {
|
|
case "xs":
|
|
return true;
|
|
case "sm":
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
</style> |