diff --git a/changelog/67_UNRELEASED_xxxx-xx-xx.md b/changelog/67_UNRELEASED_xxxx-xx-xx.md index 26a56372..41b14989 100644 --- a/changelog/67_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/67_UNRELEASED_xxxx-xx-xx.md @@ -40,6 +40,8 @@ ### Recipes +- Added a new recipes setting (top right corner settings menu) "Show a little checkbox next to each ingredient to mark it as done" (defaults to disabled) + - When enabled, next to each ingredient a little checkbox will be shown, when clicked, the ingredient is crossed out (the status is not saved, means reset when the page is reloaded) - Fixed that consuming recipes was possible when not all ingredients were in-stock (and this potentially consumed some of the in-stock ingredients; not matching the message "nothing removed") - Fixed that the price of the "Produces product"-product, which is added to stock on consuming a recipe, was wrong (was the recipe total costs multiplied by the serving amount instead of only the recipe total costs) - Fixed that calories of recipe ingredients were displayed with an indefinite number of decimal places diff --git a/config-dist.php b/config-dist.php index 90abe86f..a8258fe7 100644 --- a/config-dist.php +++ b/config-dist.php @@ -191,6 +191,7 @@ DefaultUserSetting('shopping_list_show_calendar', false); // When enabled, a sma // Recipe settings DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group DefaultUserSetting('recipes_show_list_side_by_side', true); // If the recipe should be displayed next to recipe list on the recipes page +DefaultUserSetting('recipes_show_ingredient_checkbox', false); // When enabled, a little checkbox will be shown next to each ingredient to mark it as done // Chores settings DefaultUserSetting('chores_due_soon_days', 5); // The "due soon" days diff --git a/localization/strings.pot b/localization/strings.pot index df2acada..18368968 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2329,3 +2329,9 @@ msgstr "" msgid "Out of stock items will be shown at the products default location" msgstr "" + +msgid "Show a little checkbox next to each ingredient to mark it as done" +msgstr "" + +msgid "The ingredient is crossed out when clicked, the status is not saved, means reset when the page is reloaded" +msgstr "" diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index 8dcbaab5..2fd9447f 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -431,3 +431,14 @@ $(document).on('click', '.recipe-grocycode-label-print', function(e) } }); }); + +$(document).on('click', '.ingredient-done-button', function(e) +{ + e.preventDefault(); + + // Remove the focus from the current button + // to prevent that the tooltip stays until clicked anywhere else + document.activeElement.blur(); + + $(e.currentTarget).parent().toggleClass("text-strike-through"); +}); diff --git a/public/viewjs/recipessettings.js b/public/viewjs/recipessettings.js index 43bcb317..89ddd137 100644 --- a/public/viewjs/recipessettings.js +++ b/public/viewjs/recipessettings.js @@ -7,3 +7,8 @@ if (BoolVal(Grocy.UserSettings.recipes_show_list_side_by_side)) { $("#recipes_show_list_side_by_side").prop("checked", true); } + +if (BoolVal(Grocy.UserSettings.recipes_show_ingredient_checkbox)) +{ + $("#recipes_show_ingredient_checkbox").prop("checked", true); +} diff --git a/views/recipes.blade.php b/views/recipes.blade.php index edd9453f..ce41f054 100644 --- a/views/recipes.blade.php +++ b/views/recipes.blade.php @@ -468,6 +468,15 @@ @if($selectedRecipePosition->product_active == 0)
{{ $__t('Disabled') }}
@endif + @if($userSettings['recipes_show_ingredient_checkbox']) + + + + @endif @php $product = FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id); $productQuConversions = FindAllObjectsInArrayByPropertyValue($quantityUnitConversionsResolved, 'product_id', $product->id); diff --git a/views/recipessettings.blade.php b/views/recipessettings.blade.php index d28fb95e..09d47d6c 100644 --- a/views/recipessettings.blade.php +++ b/views/recipessettings.blade.php @@ -28,6 +28,23 @@ +
+
+ + +
+
+

{{ $__t('Recipe card') }}