From 406dae6e9766ebe3217fd5d0428e01885ec90c13 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sun, 11 Apr 2021 13:16:33 -0800 Subject: [PATCH] Basic nutrition editor (#288) * Basic nutrition editor * fix no image on scrape * nutrition display * add recipe images * update by url * new upload options Co-authored-by: hay-kot --- docs/docs/changelog/v0.4.2.md | 3 +- frontend/src/api/recipe.js | 5 ++ .../Recipe/RecipeEditor/ImageUploadBtn.vue | 76 +++++++++++++++++ .../Recipe/RecipeEditor/NutritionEditor.vue | 81 +++++++++++++++++++ .../components/Recipe/RecipeEditor/index.vue | 32 ++++---- .../components/Recipe/RecipeViewer/index.vue | 5 ++ frontend/src/components/UI/UploadBtn.vue | 20 ++++- frontend/src/pages/Recipe/ViewRecipe.vue | 14 ++-- mealie/routes/recipe/recipe_crud_routes.py | 17 +++- mealie/services/image/image.py | 10 ++- 10 files changed, 234 insertions(+), 29 deletions(-) create mode 100644 frontend/src/components/Recipe/RecipeEditor/ImageUploadBtn.vue create mode 100644 frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue diff --git a/docs/docs/changelog/v0.4.2.md b/docs/docs/changelog/v0.4.2.md index fc7a61ad9..65c6ea6b4 100644 --- a/docs/docs/changelog/v0.4.2.md +++ b/docs/docs/changelog/v0.4.2.md @@ -20,4 +20,5 @@ - Set `PRODUCTION` env variable to default to true - Unify Logger across the backend - mealie.log and last_recipe.json are now downloadable from the frontend from the /admin/about -- New download schema where you request a token and then use that token to hit a single endpoint to download a file. This is a notable change if you are using the API to download backups. \ No newline at end of file +- New download schema where you request a token and then use that token to hit a single endpoint to download a file. This is a notable change if you are using the API to download backups. +- Recipe images can no be added directly from a URL - [See #177 for details](https://github.com/hay-kot/mealie/issues/117) \ No newline at end of file diff --git a/frontend/src/api/recipe.js b/frontend/src/api/recipe.js index 50e45e593..42d5c47eb 100644 --- a/frontend/src/api/recipe.js +++ b/frontend/src/api/recipe.js @@ -61,6 +61,11 @@ export const recipeAPI = { return response; }, + async updateImagebyURL(slug, url) { + const response = apiReq.post(recipeURLs.updateImage(slug), { url: url }); + return response; + }, + async update(data) { let response = await apiReq.put(recipeURLs.update(data.slug), data); store.dispatch("requestRecentRecipes"); diff --git a/frontend/src/components/Recipe/RecipeEditor/ImageUploadBtn.vue b/frontend/src/components/Recipe/RecipeEditor/ImageUploadBtn.vue new file mode 100644 index 000000000..d3154c84a --- /dev/null +++ b/frontend/src/components/Recipe/RecipeEditor/ImageUploadBtn.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue b/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue new file mode 100644 index 000000000..b74b54b72 --- /dev/null +++ b/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue @@ -0,0 +1,81 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/Recipe/RecipeEditor/index.vue b/frontend/src/components/Recipe/RecipeEditor/index.vue index f3f39030d..f4a8a3c1a 100644 --- a/frontend/src/components/Recipe/RecipeEditor/index.vue +++ b/frontend/src/components/Recipe/RecipeEditor/index.vue @@ -2,16 +2,12 @@ - - - - - + @@ -92,7 +88,7 @@ auto-grow solo dense - rows="2" + rows="1" > mdi-plus + @@ -222,17 +219,20 @@