mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-24 07:15:24 -07:00
swap to computed properties
This commit is contained in:
parent
c72ffb817e
commit
38018ddcfb
1 changed files with 64 additions and 57 deletions
|
@ -86,7 +86,26 @@ export default {
|
||||||
showSidebar: false,
|
showSidebar: false,
|
||||||
mobile: false,
|
mobile: false,
|
||||||
links: [],
|
links: [],
|
||||||
baseMainLinks: [
|
|
||||||
|
latestVersion: null,
|
||||||
|
hideImage: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getVersion();
|
||||||
|
this.resetView();
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
isMain() {
|
||||||
|
const testVal = this.$route.path.split("/");
|
||||||
|
if (testVal[1] === "recipe") this.closeSidebar();
|
||||||
|
else this.resetView();
|
||||||
|
|
||||||
|
return !(testVal[1] === "admin");
|
||||||
|
},
|
||||||
|
baseMainLinks() {
|
||||||
|
return [
|
||||||
{
|
{
|
||||||
icon: "mdi-home",
|
icon: "mdi-home",
|
||||||
to: "/",
|
to: "/",
|
||||||
|
@ -102,62 +121,7 @@ export default {
|
||||||
to: "/search",
|
to: "/search",
|
||||||
title: this.$t("search.search"),
|
title: this.$t("search.search"),
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
latestVersion: null,
|
|
||||||
hideImage: false,
|
|
||||||
settingsLinks: [
|
|
||||||
{
|
|
||||||
icon: "mdi-account",
|
|
||||||
to: "/admin/profile",
|
|
||||||
title: this.$t("settings.profile"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "mdi-format-color-fill",
|
|
||||||
to: "/admin/themes",
|
|
||||||
title: this.$t("general.themes"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "mdi-food",
|
|
||||||
to: "/admin/meal-planner",
|
|
||||||
title: this.$t("meal-plan.meal-planner"),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
adminLinks: [
|
|
||||||
{
|
|
||||||
icon: "mdi-cog",
|
|
||||||
to: "/admin/settings",
|
|
||||||
title: this.$t("settings.site-settings"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "mdi-account-group",
|
|
||||||
to: "/admin/manage-users",
|
|
||||||
title: this.$t("settings.manage-users"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "mdi-backup-restore",
|
|
||||||
to: "/admin/backups",
|
|
||||||
title: this.$t("settings.backup-and-exports"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "mdi-database-import",
|
|
||||||
to: "/admin/migrations",
|
|
||||||
title: this.$t("settings.migrations"),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getVersion();
|
|
||||||
this.resetView();
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
isMain() {
|
|
||||||
const testVal = this.$route.path.split("/");
|
|
||||||
if (testVal[1] === "recipe") this.closeSidebar();
|
|
||||||
else this.resetView();
|
|
||||||
|
|
||||||
return !(testVal[1] === "admin");
|
|
||||||
},
|
},
|
||||||
customPages() {
|
customPages() {
|
||||||
const pages = this.$store.getters.getCustomPages;
|
const pages = this.$store.getters.getCustomPages;
|
||||||
|
@ -180,6 +144,49 @@ export default {
|
||||||
mainMenu() {
|
mainMenu() {
|
||||||
return [...this.baseMainLinks, ...this.customPages];
|
return [...this.baseMainLinks, ...this.customPages];
|
||||||
},
|
},
|
||||||
|
settingsLink() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/admin/profile",
|
||||||
|
title: this.$t("settings.profile"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "mdi-format-color-fill",
|
||||||
|
to: "/admin/themes",
|
||||||
|
title: this.$t("general.themes"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "mdi-food",
|
||||||
|
to: "/admin/meal-planner",
|
||||||
|
title: this.$t("meal-plan.meal-planner"),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
adminLinks() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
icon: "mdi-cog",
|
||||||
|
to: "/admin/settings",
|
||||||
|
title: this.$t("settings.site-settings"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "mdi-account-group",
|
||||||
|
to: "/admin/manage-users",
|
||||||
|
title: this.$t("settings.manage-users"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "mdi-backup-restore",
|
||||||
|
to: "/admin/backups",
|
||||||
|
title: this.$t("settings.backup-and-exports"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "mdi-database-import",
|
||||||
|
to: "/admin/migrations",
|
||||||
|
title: this.$t("settings.migrations"),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
adminMenu() {
|
adminMenu() {
|
||||||
if (this.user.admin) {
|
if (this.user.admin) {
|
||||||
return [...this.settingsLinks, ...this.adminLinks];
|
return [...this.settingsLinks, ...this.adminLinks];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue