From a56f8be19e35d2900586c7242d9cdc32dbd013dd Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 9 Jun 2019 08:58:46 +0200 Subject: [PATCH] Fixed page reloads with unsaved form data and "Auto reload on external changes" enabled (fixes #265) --- changelog/49_2.4.2_xxxx-xx-xx.md | 3 ++- public/js/grocy.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changelog/49_2.4.2_xxxx-xx-xx.md b/changelog/49_2.4.2_xxxx-xx-xx.md index 7dde9b6f..e06b2103 100644 --- a/changelog/49_2.4.2_xxxx-xx-xx.md +++ b/changelog/49_2.4.2_xxxx-xx-xx.md @@ -2,6 +2,7 @@ - Fixed a problem that the user settings were not properly initialized for the frontend JS part when not logged only (so potentially affected only the login page) - Fixed an issue that the shopping list did not load when a plural translation for a quantity unit was missing - Fixed that tooltips were visible forever when consuming all products on the stock overview page -- Fixed that login did not work when "Stay logged in permanently" was set on grocy runs on a 32-bit system +- Fixed that login did not work when "Stay logged in permanently" was set on grocy runs on a 32-bit system (thanks @matejdro) +- Fixed page reloads when "Auto reload on external changes" is enabled and there is unsaved form data (the detection did not work on forms in modal dialogs, e. g. when adding a entry to the meal plan) - Improved that errors/messages from the API are shown properly when undoing a stock booking is not possible (stock journal page) - Improved night mode CSS (done by @BlizzWave, thanks!) diff --git a/public/js/grocy.js b/public/js/grocy.js index 296cb403..c87747b0 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -374,11 +374,11 @@ Grocy.FrontendHelpers.ShowGenericError = function(message, exception) console.error(exception); } -$("form").on("keyup paste", "input, textarea", function() +$(document).on("keyup paste change", "input, textarea", function() { $(this).closest("form").addClass("is-dirty"); }); -$("form").on("click", "select", function() +$(document).on("click", "select", function() { $(this).closest("form").addClass("is-dirty"); });