do not render price if unknown
This commit is contained in:
parent
af3454bd0d
commit
21e68445e7
3 changed files with 5 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
{% macro price(rec) -%}
|
{% macro price(price) -%}
|
||||||
{% if rec.price == None %}?{%else%}{{rec.price|round(1)|numprint}}{% endif %} CZK
|
{% if price == None %}?{%else%}{{price|round(1)|numprint}}{% endif %} CZK
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
{%block body %}
|
{%block body %}
|
||||||
<h1>Recipes</h1>
|
<h1>Recipes</h1>
|
||||||
{% for recipe in recipes %}
|
{% for recipe in recipes %}
|
||||||
<li>{{price(recipe)}} <a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
<li>{% if recipe.price != None %}{{price(recipe.price)}} {%endif%}<a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{%endblock%}
|
{%endblock%}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% macro ingredientpart(ing) -%}
|
{% macro ingredientpart(ing) -%}
|
||||||
{{price(ing)}} {{ing.amount|amountprint}} {{ing["unit"].name}} {{ ing.name }} {{ing.note}}
|
{% if recipe.price != None %}{{price(ing.price)}} {%endif%}{{ing.amount|amountprint}} {{ing["unit"].name}} {{ ing.name }} {{ing.note}}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro ingredient(ing) -%}
|
{% macro ingredient(ing) -%}
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
{% for ing in rec.ingredients %}
|
{% for ing in rec.ingredients %}
|
||||||
<li>{{ingredient(ing)}}</li>
|
<li>{{ingredient(ing)}}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
price: {{ price(rec) }}
|
{% if recipe.price != None %}price: {{price(rec.price)}}{%endif%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rec.steps|length != 0 %}
|
{% if rec.steps|length != 0 %}
|
||||||
<h3>Steps</h3>
|
<h3>Steps</h3>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue