2016-01-07 12:29:56 +00:00
|
|
|
{% macro mapping_table(caption='', field_headings=[], field_headings_visible=True, caption_visible=True) -%}
|
2015-12-10 17:54:05 +00:00
|
|
|
<table class="table">
|
2015-12-17 11:52:24 +00:00
|
|
|
<caption class="heading-medium table-heading{{ ' visuallyhidden' if not caption_visible}}">
|
2015-12-10 17:54:05 +00:00
|
|
|
{{ caption }}
|
|
|
|
|
</caption>
|
|
|
|
|
<thead class="table-field-headings{% if field_headings_visible %}-visible{% endif %}">
|
|
|
|
|
<tr>
|
|
|
|
|
{% for field_heading in field_headings %}
|
|
|
|
|
<th scope="col" class="table-field-heading{% if loop.first %}-first{% endif %}">
|
|
|
|
|
{% if field_headings_visible %}
|
|
|
|
|
{{ field_heading }}
|
|
|
|
|
{% else %}
|
|
|
|
|
<span class="visuallyhidden">{{ field_heading }}</span>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</th>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2016-01-07 12:29:56 +00:00
|
|
|
{{ caller() }}
|
2015-12-10 17:54:05 +00:00
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-01-07 12:29:56 +00:00
|
|
|
{% macro list_table(items, caption='', empty_message='', field_headings=[], field_headings_visible=True, caption_visible=True) -%}
|
2016-01-19 11:15:00 +00:00
|
|
|
|
|
|
|
|
{% set parent_caller = caller %}
|
2016-02-03 14:43:16 +00:00
|
|
|
|
|
|
|
|
{% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %}
|
|
|
|
|
{% for item in items %}
|
|
|
|
|
{% call row() %}
|
|
|
|
|
{{ parent_caller(item) }}
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% if not items %}
|
|
|
|
|
{% call row() %}
|
|
|
|
|
<td class="table-empty-message" colspan="10">
|
|
|
|
|
{{ empty_message }}
|
|
|
|
|
</td>
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{%- endcall %}
|
2016-01-19 11:15:00 +00:00
|
|
|
|
2016-01-07 12:29:56 +00:00
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
|
|
{% macro row() -%}
|
|
|
|
|
<tr class="table-row">
|
|
|
|
|
{{ caller() }}
|
|
|
|
|
</tr>
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2015-12-17 11:14:19 +00:00
|
|
|
{% macro field(align='left', status='') -%}
|
|
|
|
|
<td class="table-field{% if align == 'right' %}-right-aligned{% endif %}">
|
|
|
|
|
<span class="{{ 'table-field-status-' + status if status }}">{{ caller() }}</span>
|
2015-12-10 17:54:05 +00:00
|
|
|
</td>
|
|
|
|
|
{%- endmacro %}
|
2015-12-17 11:14:19 +00:00
|
|
|
|
|
|
|
|
{% macro right_aligned_field_heading(text) %}
|
|
|
|
|
<span class="table-field-heading-right-aligned">{{ text }}</span>
|
|
|
|
|
{%- endmacro %}
|
2016-01-19 09:55:13 +00:00
|
|
|
|
|
|
|
|
{% macro hidden_field_heading(text) %}
|
|
|
|
|
<span class="visuallyhidden">{{ text }}</span>
|
|
|
|
|
{%- endmacro %}
|