show full recipe price every time with a clarification if necessary
This commit is contained in:
parent
8046f0d237
commit
88f801cadb
4 changed files with 40 additions and 7 deletions
|
@ -1,6 +1,17 @@
|
|||
{% macro price(price) -%}
|
||||
{% if price != None and price is defined and price.price is defined %}{{price.price|round(1)|numprint}}{%else%}?{% endif %} {{price.currency}}
|
||||
{%- endmacro %}
|
||||
{% macro multiprice(multiprice, shortform) -%}
|
||||
{% if multiprice != None and multiprice.pricedb != None and multiprice.pricedb is defined and multiprice.pricedb.price is defined -%}
|
||||
{{multiprice.pricedb.price|round(1)|numprint}}
|
||||
{%else%}
|
||||
?
|
||||
{%- endif %}
|
||||
{{multiprice.pricedb.currency}}
|
||||
{%if multiprice.item_prices_missing != 0 and not shortform%}
|
||||
({{multiprice.item_prices_missing}}/{{multiprice.item_count}} prices missing)
|
||||
{%endif%}
|
||||
{%- endmacro %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
{%block body %}
|
||||
<h1>Recipes</h1>
|
||||
{% for recipe in recipes %}
|
||||
<li>{% if recipe.price != None %}{{price(recipe.price)}} {%endif%}<a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
||||
<li>{% if recipe.price != None %}{{multiprice(recipe.price, true)}} {%endif%}<a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
||||
{% endfor %}
|
||||
{%endblock%}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% macro ingredientpart(ing) -%}
|
||||
{% if recipe.price != None %}{{price(ing.price)}} {%endif%}
|
||||
{% if ing.price != None %}{{price(ing.price)}} {%endif%}
|
||||
{% if ing.amount != None %} {{ing.amount|amountprint}}
|
||||
{% if ing.unit != None %} {{ing.unit.name}}{% endif %}
|
||||
{%endif%}
|
||||
|
@ -29,7 +29,10 @@
|
|||
{% for ing in rec.ingredients %}
|
||||
<li>{{ingredient(ing)}}</li>
|
||||
{% endfor %}
|
||||
{% if rec.price != None %}price: {{price(rec.price)}}{%endif%}
|
||||
{% if rec.price != None %}
|
||||
<br>
|
||||
price: {{multiprice(rec.price)}}
|
||||
{%endif%}
|
||||
{% endif %}
|
||||
{% if rec.stepsections|length != 0 %}
|
||||
<h3>Steps</h3>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue