From 540ae2627ae7d0fb6e27f49ecff2805be6f61b5e Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 9 Feb 2020 21:01:29 +0100 Subject: [PATCH] Changelog & small changes for #554 --- changelog/56_UNRELEASED_2020-xx-xx.md | 1 + public/viewjs/mealplan.js | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/changelog/56_UNRELEASED_2020-xx-xx.md b/changelog/56_UNRELEASED_2020-xx-xx.md index c25850c7..654fe8c2 100644 --- a/changelog/56_UNRELEASED_2020-xx-xx.md +++ b/changelog/56_UNRELEASED_2020-xx-xx.md @@ -19,6 +19,7 @@ ### Meal plan improvements - Improved that all add-dialogs can be submitted by using `ENTER` and that the next input is automatically selected after selecting a recipe/product - Added an edit button to all types of meal plan entries +- When adding a recipe, the serving amount is now prefilled with the one of the selected recipe (thanks @kriddles) - Fixed that the meal plan not used the full height on mobile devices ### Calendar fixes diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index 36df81f2..82773ee5 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -283,7 +283,6 @@ $(document).on("click", ".add-recipe-button", function(e) $("#add-recipe-modal-title").text(__t("Add recipe to %s", day.toString())); $("#day").val(day.toString()); - $("#recipe_servings").val(1); Grocy.Components.RecipePicker.Clear(); $("#add-recipe-modal").modal("show"); Grocy.FrontendHelpers.ValidateForm("add-recipe-form"); @@ -777,17 +776,12 @@ Grocy.Components.RecipePicker.GetPicker().on('change', function(e) if (recipeId) { - // Does not work (clears the RecipePicker) when done immediately, don't know why... - setTimeout(function() - { - $("#recipe_servings").focus(); - $("#recipe_servings").select(); - }, 200); - Grocy.Api.Get('objects/recipes/' + recipeId, function(recipe) { $("#recipe_servings").val(recipe.base_servings); + $("#recipe_servings").focus(); + $("#recipe_servings").select(); }, function(xhr) {