From dea2ffeaafa6cf7030ecba87f20f63bc3e54935d Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 28 Sep 2019 08:48:58 +0200 Subject: [PATCH] Added a "clear" button above the new notes field on the shopping list page --- changelog/53_UNRELEASED_2019-xx-xx.md | 5 ++++- localization/strings.pot | 3 +++ public/viewjs/shoppinglist.js | 21 +++++++++++++++++++++ views/shoppinglist.blade.php | 3 ++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/changelog/53_UNRELEASED_2019-xx-xx.md b/changelog/53_UNRELEASED_2019-xx-xx.md index a42a03e2..7b852cbf 100644 --- a/changelog/53_UNRELEASED_2019-xx-xx.md +++ b/changelog/53_UNRELEASED_2019-xx-xx.md @@ -4,10 +4,13 @@ - Fixed that after product actions (consume/purchase/etc.) on the stock overview page the highlighting of the row was maybe wrong - After product actions (consume/purchase/etc.) on the stock overview page on a sub product, now also the parent product (row) is refreshed - It's now possible to accumulate min. stock amounts on parent product level (new option per product, means the sub product will never be "missing" then, only the parent product) -- When adding a product to the shopping list from the new context/more menu from the stock overview page and if the product is already on the shopping list, the amount of that entry will be updated acccordingly instead of adding a new (double) shopping list item - On the purchase page there is now an option to select that the price is the total price (for the whole amount) - below the price field, defaults to "Unit price" (as it was until now), when set to "Total price", the entered price will be divided by the amount before posting - "Average shelf life" on the product card now displays just "Unlimited" when the resulting value would be > 200 years (for products which never expire, as they have a best before date of 2999-12-31) +### Shopping list improvements +- When adding a product to the shopping list from the new context/more menu from the stock overview page and if the product is already on the shopping list, the amount of that entry will be updated acccordingly instead of adding a new (double) shopping list item +- Added a "clear" button above the new notes field on the shopping list page to quickly clear the notes field with one click + ### Recipe improvements/fixes - Fixed a problem regarding quantity unit conversion handling for recipe ingredients of products with no unit relations, but only a different purchase/stock quantity unit - It's now possible to display a recipe directly from the meal plan (new "eye button") (thanks @kriddles) diff --git a/localization/strings.pot b/localization/strings.pot index 181a7698..342fd81e 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1540,3 +1540,6 @@ msgstr "" msgid "Unlimited" msgstr "" + +msgid "Clear" +msgstr "" diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 85360a66..5006a4e6 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -316,6 +316,15 @@ $(document).on("click", "#print-shopping-list-button", function(e) $("#description").on("summernote.change", function() { $("#save-description-button").removeClass("disabled"); + + if ($("#description").summernote("isEmpty")) + { + $("#clear-description-button").addClass("disabled"); + } + else + { + $("#clear-description-button").removeClass("disabled"); + } }); $(document).on("click", "#save-description-button", function(e) @@ -334,3 +343,15 @@ $(document).on("click", "#save-description-button", function(e) } ); }); + +$(document).on("click", "#clear-description-button", function(e) +{ + e.preventDefault(); + document.activeElement.blur(); + + $("#description").summernote("reset"); + $("#save-description-button").click(); +}); + +$("#description").trigger("summernote.change"); +$("#save-description-button").addClass("disabled"); diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index edf97320..2bfc049f 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -149,7 +149,8 @@
- {{ $__t('Save') }} + {{ $__t('Save') }} + {{ $__t('Clear') }}