mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
Display DecimalToFraction with recipes user setting
This commit is contained in:
parent
0475b8c093
commit
1481657554
|
|
@ -101,6 +101,7 @@ DefaultUserSetting('shopping_list_disable_auto_compact_view_on_mobile', false);
|
|||
|
||||
# Recipe settings
|
||||
DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group
|
||||
DefaultUserSetting('recipe_ingredient_display_as_fractions', false); // Display the ingredient amounts as fractions
|
||||
|
||||
# Chores settings
|
||||
DefaultUserSetting('chores_due_soon_days', 5);
|
||||
|
|
|
|||
|
|
@ -2,3 +2,7 @@
|
|||
{
|
||||
$("#recipe_ingredients_group_by_product_group").prop("checked", true);
|
||||
}
|
||||
if (BoolVal(Grocy.UserSettings.recipe_ingredient_display_as_fractions))
|
||||
{
|
||||
$("#recipe_ingredient_display_as_fractions").prop("checked", true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,11 @@
|
|||
@if(!empty($recipePosition->variable_amount))
|
||||
{{ $recipePosition->variable_amount }}
|
||||
@else
|
||||
<span class="locale-number locale-number-quantity-amount">@if($recipePosition->amount == round($recipePosition->amount)){{ round($recipePosition->amount) }}@else{{ $recipePosition->amount }}@endif</span>
|
||||
@if(boolval($userSettings['recipe_ingredient_display_as_fractions']))
|
||||
{{ DecimalToFraction($recipePosition->amount) }}
|
||||
@else
|
||||
<span class="locale-number locale-number-quantity-amount">@if($recipePosition->amount == round($recipePosition->amount)){{ round($recipePosition->amount) }}@else{{ $recipePosition->amount }}@endif</span>
|
||||
@endif
|
||||
@endif
|
||||
{{ $__n($recipePosition->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name_plural) }}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,11 @@
|
|||
@if(!empty($selectedRecipePosition->recipe_variable_amount))
|
||||
{{ $selectedRecipePosition->recipe_variable_amount }}
|
||||
@else
|
||||
<span class="locale-number locale-number-quantity-amount">@if($selectedRecipePosition->recipe_amount == round($selectedRecipePosition->recipe_amount, 2)){{ round($selectedRecipePosition->recipe_amount, 2) }}@else{{ $selectedRecipePosition->recipe_amount }}@endif</span>
|
||||
@if(boolval($userSettings['recipe_ingredient_display_as_fractions']))
|
||||
{{ DecimalToFraction($selectedRecipePosition->recipe_amount) }}
|
||||
@else
|
||||
<span class="locale-number locale-number-quantity-amount">@if($selectedRecipePosition->recipe_amount == round($selectedRecipePosition->recipe_amount)){{ round($selectedRecipePosition->recipe_amount) }}@else{{ $selectedRecipePosition->recipe_amount }}@endif</span>
|
||||
@endif
|
||||
@endif
|
||||
{{ $__n($selectedRecipePosition->recipe_amount, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name_plural) }} {{ FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id)->name }}
|
||||
@if($selectedRecipePosition->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif($selectedRecipePosition->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif
|
||||
|
|
@ -287,7 +291,11 @@
|
|||
@if(!empty($selectedRecipePosition->recipe_variable_amount))
|
||||
{{ $selectedRecipePosition->recipe_variable_amount }}
|
||||
@else
|
||||
<span class="locale-number locale-number-quantity-amount">@if($selectedRecipePosition->recipe_amount == round($selectedRecipePosition->recipe_amount, 2)){{ round($selectedRecipePosition->recipe_amount, 2) }}@else{{ $selectedRecipePosition->recipe_amount }}@endif</span>
|
||||
@if(boolval($userSettings['recipe_ingredient_display_as_fractions']))
|
||||
{{ DecimalToFraction($selectedRecipePosition->recipe_amount) }}
|
||||
@else
|
||||
<span class="locale-number locale-number-quantity-amount">@if($selectedRecipePosition->recipe_amount == round($selectedRecipePosition->recipe_amount)){{ round($selectedRecipePosition->recipe_amount) }}@else{{ $selectedRecipePosition->recipe_amount }}@endif</span>
|
||||
@endif
|
||||
@endif
|
||||
{{ $__n($selectedRecipePosition->recipe_amount, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityUnits, 'id', $selectedRecipePosition->qu_id)->name_plural) }} {{ FindObjectInArrayByPropertyValue($products, 'id', $selectedRecipePosition->product_id)->name }}
|
||||
@if($selectedRecipePosition->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif($selectedRecipePosition->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label for="recipe_ingredient_display_as_fractions">
|
||||
<input type="checkbox" class="user-setting-control" id="recipe_ingredient_display_as_fractions" name="recipe_ingredient_display_as_fractions" data-setting-key="recipe_ingredient_display_as_fractions"> {{ $__t('Display as fractions.') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{{ $U('/recipes') }}" class="btn btn-success">{{ $__t('OK') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user