From e980fe6fc8138af2a5d28d5bd8d6ad2e6edeffa5 Mon Sep 17 00:00:00 2001 From: Tom Nowell Date: Tue, 10 Dec 2024 12:24:53 +0000 Subject: [PATCH 1/5] Add delete button and functionality to recipe image modal --- .../Domain/Recipe/RecipeImageUploadBtn.vue | 13 ++++++++++++- .../RecipePageParts/RecipePageEditorToolbar.vue | 14 ++++++++++++-- frontend/lib/api/types/recipe.ts | 2 +- frontend/lib/api/user/recipes/recipe.ts | 4 ++++ mealie/repos/repository_recipes.py | 5 +++++ mealie/routes/recipe/recipe_crud_routes.py | 8 +++++++- mealie/services/recipe/recipe_data_service.py | 8 ++++++++ 7 files changed, 49 insertions(+), 5 deletions(-) diff --git a/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue b/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue index ab16c760fc1..83f58fb58d8 100644 --- a/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue +++ b/frontend/components/Domain/Recipe/RecipeImageUploadBtn.vue @@ -9,7 +9,7 @@ {{ $t("general.image") }} - +
{{ $t("recipe.recipe-image") }} @@ -22,6 +22,10 @@ :post="false" @uploaded="uploadImage" /> + + {{ $globals.icons.delete }} + {{ $t("general.delete") }} +
@@ -45,6 +49,7 @@ import { useUserApi } from "~/composables/api"; const REFRESH_EVENT = "refresh"; const UPLOAD_EVENT = "upload"; +const DELETE_EVENT = "delete"; export default defineComponent({ props: { @@ -65,6 +70,11 @@ export default defineComponent({ state.menu = false; } + function deleteImage() { + context.emit(DELETE_EVENT); + state.menu = false; + } + const api = useUserApi(); async function getImageFromURL() { state.loading = true; @@ -81,6 +91,7 @@ export default defineComponent({ return { ...toRefs(state), uploadImage, + deleteImage, getImageFromURL, messages, }; diff --git a/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageEditorToolbar.vue b/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageEditorToolbar.vue index a3508e434a3..fff16602cb0 100644 --- a/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageEditorToolbar.vue +++ b/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageEditorToolbar.vue @@ -1,6 +1,6 @@