mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 22:43:34 -07:00
initial context menu
This commit is contained in:
parent
d77b858d0d
commit
b992286889
1 changed files with 44 additions and 0 deletions
|
@ -42,6 +42,12 @@ export default {
|
||||||
loggedIn() {
|
loggedIn() {
|
||||||
return this.$store.getters.getIsLoggedIn;
|
return this.$store.getters.getIsLoggedIn;
|
||||||
},
|
},
|
||||||
|
baseURL() {
|
||||||
|
return window.location.origin;
|
||||||
|
},
|
||||||
|
recipeURL() {
|
||||||
|
return `${this.baseURL}/recipe/${this.slug}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -52,6 +58,24 @@ export default {
|
||||||
color: "error",
|
color: "error",
|
||||||
action: "delete",
|
action: "delete",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Edit",
|
||||||
|
icon: "mdi-square-edit-outline",
|
||||||
|
color: "accent",
|
||||||
|
action: "edit",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Download",
|
||||||
|
icon: "mdi-download",
|
||||||
|
color: "accent",
|
||||||
|
action: "download",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Link",
|
||||||
|
icon: "mdi-content-copy",
|
||||||
|
color: "accent",
|
||||||
|
action: "share",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
loading: false,
|
loading: false,
|
||||||
};
|
};
|
||||||
|
@ -64,12 +88,32 @@ export default {
|
||||||
case "delete":
|
case "delete":
|
||||||
await api.recipes.delete(this.slug);
|
await api.recipes.delete(this.slug);
|
||||||
break;
|
break;
|
||||||
|
case "share":
|
||||||
|
this.updateClipboard();
|
||||||
|
break;
|
||||||
|
case "edit":
|
||||||
|
this.$router.push(`/recipe/${this.slug}` + "?edit=true");
|
||||||
|
break;
|
||||||
|
case "download":
|
||||||
|
console.log("Download");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
|
updateClipboard() {
|
||||||
|
const copyText = this.recipeURL;
|
||||||
|
navigator.clipboard.writeText(copyText).then(
|
||||||
|
function() {
|
||||||
|
console.log("Copied", copyText);
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
console.log("Copy Failed", copyText);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue