Add ‘optional text’ macro

This pattern of value or grey text saying `None` is common enough in our
app that we should codify it into a pattern. Which this commit does.
This commit is contained in:
Chris Hill-Scott
2017-10-05 11:21:00 +01:00
parent ff6b2b01dd
commit 521b5b6cf1
2 changed files with 12 additions and 9 deletions

View File

@@ -92,6 +92,13 @@
{% endcall %}
{%- endmacro %}
{% macro optional_text_field(text, default=None) -%}
{{ text_field(
text or default,
status='' if text else 'default'
) }}
{%- endmacro %}
{% macro link_field(text, link) -%}
{% call field() %}
<a href="{{ link }}">{{ text }}</a>