From 5cfe7cf34de0e2980669c07a7fcb1ef2f12ade25 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 6 Mar 2020 20:51:09 +0100 Subject: [PATCH] Fixed that the recipe page was reloaded when expanding a collapsed row on mobile (fixes #589) --- changelog/56_UNRELEASED_2020-xx-xx.md | 1 + public/viewjs/recipes.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog/56_UNRELEASED_2020-xx-xx.md b/changelog/56_UNRELEASED_2020-xx-xx.md index fd99f20a..47190f10 100644 --- a/changelog/56_UNRELEASED_2020-xx-xx.md +++ b/changelog/56_UNRELEASED_2020-xx-xx.md @@ -22,6 +22,7 @@ If you run grocy in a subdirectory, you need to set a new `config.php` setting ( - Fixed that nested recipes showed all ingredients of the nested recipes twice - Fixed that when displaying or consuming a recipe from the meal plan the serving amount was maybe wrong (was the one from the recipe instead the one from the meal plan entry) (thanks @kriddles) - Fixed that the stock fulfillment counts on the recipe card were maybe wrong if that recipe was also added to the meal plan (thanks @kriddles) +- Fixed that the recipe page was reloaded when expanding a collapsed row on mobile (thanks @Mikhail5555) ### 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 diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index 044f05e1..6898b004 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -208,7 +208,11 @@ recipesTables.on('select', function(e, dt, type, indexes) if (type === 'row') { var selectedRecipeId = $(recipesTables.row(indexes[0]).node()).data("recipe-id"); - window.location.href = U('/recipes?recipe=' + selectedRecipeId.toString()); + var currentRecipeId = location.search.split('recipe=')[1]; + if (selectedRecipeId.toString() !== currentRecipeId) + { + window.location.href = U('/recipes?recipe=' + selectedRecipeId.toString()); + } } });