mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 22:43:34 -07:00
localize
This commit is contained in:
parent
b992286889
commit
d114f375a0
3 changed files with 45 additions and 31 deletions
|
@ -1,9 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="text-center" v-if="loggedIn">
|
<div class="text-center">
|
||||||
<v-menu offset-y top left>
|
<v-menu offset-y top left>
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<template v-slot:activator="{ on, attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
:loading="loading"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
icon
|
icon
|
||||||
dark
|
dark
|
||||||
|
@ -16,7 +15,7 @@
|
||||||
</template>
|
</template>
|
||||||
<v-list dense>
|
<v-list dense>
|
||||||
<v-list-item
|
<v-list-item
|
||||||
v-for="(item, index) in items"
|
v-for="(item, index) in loggedIn ? userMenu : defaultMenu"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="menuAction(item.action)"
|
@click="menuAction(item.action)"
|
||||||
>
|
>
|
||||||
|
@ -48,36 +47,43 @@ export default {
|
||||||
recipeURL() {
|
recipeURL() {
|
||||||
return `${this.baseURL}/recipe/${this.slug}`;
|
return `${this.baseURL}/recipe/${this.slug}`;
|
||||||
},
|
},
|
||||||
},
|
defaultMenu() {
|
||||||
data() {
|
return [
|
||||||
return {
|
|
||||||
items: [
|
|
||||||
{
|
{
|
||||||
title: "Delete",
|
title: this.$t("general.download"),
|
||||||
icon: "mdi-delete",
|
|
||||||
color: "error",
|
|
||||||
action: "delete",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Edit",
|
|
||||||
icon: "mdi-square-edit-outline",
|
|
||||||
color: "accent",
|
|
||||||
action: "edit",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Download",
|
|
||||||
icon: "mdi-download",
|
icon: "mdi-download",
|
||||||
color: "accent",
|
color: "accent",
|
||||||
action: "download",
|
action: "download",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Link",
|
title: this.$t("general.link"),
|
||||||
icon: "mdi-content-copy",
|
icon: "mdi-content-copy",
|
||||||
color: "accent",
|
color: "accent",
|
||||||
action: "share",
|
action: "share",
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
loading: false,
|
},
|
||||||
|
userMenu() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
title: this.$t("general.delete"),
|
||||||
|
icon: "mdi-delete",
|
||||||
|
color: "error",
|
||||||
|
action: "delete",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t("general.edit"),
|
||||||
|
icon: "mdi-square-edit-outline",
|
||||||
|
color: "accent",
|
||||||
|
action: "edit",
|
||||||
|
},
|
||||||
|
...this.defaultMenu,
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -106,12 +112,8 @@ export default {
|
||||||
updateClipboard() {
|
updateClipboard() {
|
||||||
const copyText = this.recipeURL;
|
const copyText = this.recipeURL;
|
||||||
navigator.clipboard.writeText(copyText).then(
|
navigator.clipboard.writeText(copyText).then(
|
||||||
function() {
|
() => console.log("Copied", copyText),
|
||||||
console.log("Copied", copyText);
|
() => console.log("Copied Failed", copyText)
|
||||||
},
|
|
||||||
function() {
|
|
||||||
console.log("Copy Failed", copyText);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
"image-upload-failed": "Image upload failed",
|
"image-upload-failed": "Image upload failed",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"keyword": "Keyword",
|
"keyword": "Keyword",
|
||||||
|
"link": "Link",
|
||||||
"monday": "Monday",
|
"monday": "Monday",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"no": "No",
|
"no": "No",
|
||||||
|
|
|
@ -99,7 +99,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
skeleton: true,
|
skeleton: true,
|
||||||
// currentRecipe: this.$route.params.recipe,
|
|
||||||
form: false,
|
form: false,
|
||||||
jsonEditor: false,
|
jsonEditor: false,
|
||||||
jsonEditorOptions: {
|
jsonEditorOptions: {
|
||||||
|
@ -129,6 +128,9 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getRecipeDetails();
|
this.getRecipeDetails();
|
||||||
|
this.jsonEditor = false;
|
||||||
|
this.form = Boolean(this.edit);
|
||||||
|
console.log(this.form);
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -141,6 +143,9 @@ export default {
|
||||||
currentRecipe() {
|
currentRecipe() {
|
||||||
return this.$route.params.recipe;
|
return this.$route.params.recipe;
|
||||||
},
|
},
|
||||||
|
edit() {
|
||||||
|
return this.$route.query.edit;
|
||||||
|
},
|
||||||
showIcons() {
|
showIcons() {
|
||||||
return this.form;
|
return this.form;
|
||||||
},
|
},
|
||||||
|
@ -182,7 +187,13 @@ export default {
|
||||||
},
|
},
|
||||||
async saveImage(overrideSuccessMsg = false) {
|
async saveImage(overrideSuccessMsg = false) {
|
||||||
if (this.fileObject) {
|
if (this.fileObject) {
|
||||||
if (api.recipes.updateImage(this.recipeDetails.slug, this.fileObject, overrideSuccessMsg)) {
|
if (
|
||||||
|
api.recipes.updateImage(
|
||||||
|
this.recipeDetails.slug,
|
||||||
|
this.fileObject,
|
||||||
|
overrideSuccessMsg
|
||||||
|
)
|
||||||
|
) {
|
||||||
this.imageKey += 1;
|
this.imageKey += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue