Merge remote-tracking branch 'upstream/dev' into localization

This commit is contained in:
Florian Dupret 2021-04-14 17:36:06 +02:00
commit 40e022b552
8 changed files with 103 additions and 28 deletions

View file

@ -12,6 +12,7 @@
v-model="ingredient.checked" v-model="ingredient.checked"
class="pt-0 my-auto py-auto" class="pt-0 my-auto py-auto"
color="secondary" color="secondary"
:readonly="true"
> >
</v-checkbox> </v-checkbox>

View file

@ -54,22 +54,11 @@ export default {
{ {
icon: "mdi-magnify", icon: "mdi-magnify",
to: "/search", to: "/search",
title: "search", title: this.$t('search.search'),
}, },
], ],
}; };
}, },
computed: {
allCategories() {
return this.$store.getters.getCategories;
},
},
watch: {
allCategories() {
this.buildSidebar();
},
showSidebar() {},
},
mounted() { mounted() {
this.buildSidebar(); this.buildSidebar();
this.mobile = this.viewScale(); this.mobile = this.viewScale();
@ -81,14 +70,27 @@ export default {
this.links = []; this.links = [];
this.links.push(...this.baseLinks); this.links.push(...this.baseLinks);
const pages = await api.siteSettings.getPages(); const pages = await api.siteSettings.getPages();
pages.sort((a, b) => a.position - b.position); if(pages.length > 0) {
pages.forEach(async element => { pages.sort((a, b) => a.position - b.position);
this.links.push({ pages.forEach(async element => {
title: element.name, this.links.push({
to: `/pages/${element.slug}`, title: element.name,
icon: "mdi-tag", 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() { viewScale() {
switch (this.$vuetify.breakpoint.name) { switch (this.$vuetify.breakpoint.name) {

View file

@ -93,7 +93,7 @@
"groups": "Gruppen", "groups": "Gruppen",
"could-not-validate-credentials": "Anmeldeinformationen konnten nicht validiert werden", "could-not-validate-credentials": "Anmeldeinformationen konnten nicht validiert werden",
"login": "Anmeldung", "login": "Anmeldung",
"groups-can-only-be-set-by-administrators": "Groups can only be set by administrators", "groups-can-only-be-set-by-administrators": "Gruppen können nur durch einen Administrator gesetzt werden",
"upload-photo": "Foto hochladen", "upload-photo": "Foto hochladen",
"reset-password": "Passwort zurücksetzen", "reset-password": "Passwort zurücksetzen",
"current-password": "Aktuelles Passwort", "current-password": "Aktuelles Passwort",

View file

@ -48,7 +48,8 @@
"apply": "Apply", "apply": "Apply",
"current-parenthesis": "(Current)", "current-parenthesis": "(Current)",
"users": "Users", "users": "Users",
"groups": "Groups" "groups": "Groups",
"about": "About"
}, },
"page": { "page": {
"home-page": "Home Page", "home-page": "Home Page",
@ -153,7 +154,8 @@
"include": "Include", "include": "Include",
"exclude": "Exclude", "exclude": "Exclude",
"and": "And", "and": "And",
"or": "Or" "or": "Or",
"search": "Search"
}, },
"settings": { "settings": {
"general-settings": "General Settings", "general-settings": "General Settings",

View file

@ -48,7 +48,8 @@
"apply": "Appliquer", "apply": "Appliquer",
"current-parenthesis": "(Actuel)", "current-parenthesis": "(Actuel)",
"groups": "Groupes", "groups": "Groupes",
"users": "Utilisateurs" "users": "Utilisateurs",
"about": "À propos"
}, },
"page": { "page": {
"home-page": "Accueil", "home-page": "Accueil",
@ -153,7 +154,8 @@
"include": "Inclure", "include": "Inclure",
"max-results": "Résultats max", "max-results": "Résultats max",
"or": "Ou", "or": "Ou",
"tag-filter": "Filtre par tags" "tag-filter": "Filtre par tags",
"search": "Rechercher"
}, },
"settings": { "settings": {
"general-settings": "Paramètres généraux", "general-settings": "Paramètres généraux",

View file

@ -18,6 +18,20 @@ const router = new VueRouter({
mode: process.env.NODE_ENV === "production" ? "history" : "hash", mode: process.env.NODE_ENV === "production" ? "history" : "hash",
}); });
const DEFAULT_TITLE = 'Mealie';
const TITLE_SEPARATOR = '🍴';
const TITLE_SUFFIX = " " + TITLE_SEPARATOR + " " + DEFAULT_TITLE;
router.afterEach( (to) => {
Vue.nextTick( async () => {
if(typeof to.meta.title === 'function' ) {
const title = await to.meta.title(to);
document.title = title + TITLE_SUFFIX;
} else {
document.title = to.meta.title ? to.meta.title + TITLE_SUFFIX : DEFAULT_TITLE;
}
});
});
const vueApp = new Vue({ const vueApp = new Vue({
vuetify, vuetify,
store, store,

View file

@ -8,6 +8,7 @@ import ManageUsers from "@/pages/Admin/ManageUsers";
import Settings from "@/pages/Admin/Settings"; import Settings from "@/pages/Admin/Settings";
import About from "@/pages/Admin/About"; import About from "@/pages/Admin/About";
import { store } from "../store"; import { store } from "../store";
import i18n from '@/i18n.js';
export default { export default {
path: "/admin", path: "/admin",
@ -25,35 +26,59 @@ export default {
{ {
path: "profile", path: "profile",
component: Profile, component: Profile,
meta: {
title: i18n.t('settings.profile'),
},
}, },
{ {
path: "backups", path: "backups",
component: Backup, component: Backup,
meta: {
title: i18n.t('settings.backup-and-exports'),
},
}, },
{ {
path: "themes", path: "themes",
component: Theme, component: Theme,
meta: {
title: i18n.t('general.themes'),
},
}, },
{ {
path: "meal-planner", path: "meal-planner",
component: MealPlanner, component: MealPlanner,
meta: {
title: i18n.t('meal-plan.meal-planner'),
},
}, },
{ {
path: "migrations", path: "migrations",
component: Migration, component: Migration,
meta: {
title: i18n.t('settings.migrations'),
},
}, },
{ {
path: "manage-users", path: "manage-users",
component: ManageUsers, component: ManageUsers,
meta: {
title: i18n.t('settings.manage-users'),
},
}, },
{ {
path: "settings", path: "settings",
component: Settings, component: Settings,
meta: {
title: i18n.t('settings.site-settings'),
},
}, },
{ {
path: "about", path: "about",
component: About, component: About,
meta: {
title: i18n.t('general.about'),
},
}, },
], ],
}; };

View file

@ -15,6 +15,7 @@ import ThisWeek from "@/pages/MealPlan/ThisWeek";
import { api } from "@/api"; import { api } from "@/api";
import Admin from "./admin"; import Admin from "./admin";
import { store } from "../store"; import { store } from "../store";
import i18n from '@/i18n.js';
export const routes = [ export const routes = [
{ path: "/", name: "home", component: HomePage }, { path: "/", name: "home", component: HomePage },
@ -31,15 +32,43 @@ export const routes = [
{ path: "/sign-up", redirect: "/" }, { path: "/sign-up", redirect: "/" },
{ path: "/sign-up/:token", component: SignUpPage }, { path: "/sign-up/:token", component: SignUpPage },
{ path: "/debug", component: Debug }, { path: "/debug", component: Debug },
{ path: "/search", component: SearchPage }, {
path: "/search",
component: SearchPage,
meta: {
title: i18n.t('search.search'),
},
},
{ path: "/recipes/all", component: AllRecipes }, { path: "/recipes/all", component: AllRecipes },
{ path: "/pages/:customPage", component: CustomPage }, { path: "/pages/:customPage", component: CustomPage },
{ path: "/recipes/tag/:tag", component: TagPage }, { path: "/recipes/tag/:tag", component: TagPage },
{ path: "/recipes/category/:category", component: CategoryPage }, { path: "/recipes/category/:category", component: CategoryPage },
{ path: "/recipe/:recipe", component: ViewRecipe }, {
path: "/recipe/:recipe",
component: ViewRecipe,
meta: {
title: async route => {
const recipe = await api.recipes.requestDetails(route.params.recipe);
return recipe.name;
},
}
},
{ path: "/new/", component: NewRecipe }, { path: "/new/", component: NewRecipe },
{ path: "/meal-plan/planner", component: Planner }, {
{ path: "/meal-plan/this-week", component: ThisWeek }, path: "/meal-plan/planner",
component: Planner,
meta: {
title: i18n.t('meal-plan.meal-planner'),
}
},
{
path: "/meal-plan/this-week",
component: ThisWeek,
meta: {
title: i18n.t('meal-plan.dinner-this-week'),
}
},
Admin, Admin,
{ {
path: "/meal-plan/today", path: "/meal-plan/today",