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 %}
|
2016-09-09 15:50:55 +01:00
|
|
|
{% call row(item.id) %}
|
2016-04-05 11:16:29 +01:00
|
|
|
{{ parent_caller(item, loop.index + 1) }}
|
2016-02-03 14:43:16 +00:00
|
|
|
{% 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 %}
|
|
|
|
|
|
2016-09-09 15:50:55 +01:00
|
|
|
{% macro row(id=None) -%}
|
|
|
|
|
<tr class="table-row" {% if id %}id="{{id}}"{% endif %}>
|
2016-01-07 12:29:56 +00:00
|
|
|
{{ caller() }}
|
|
|
|
|
</tr>
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-11-14 14:46:26 +00:00
|
|
|
{% macro row_group(id=None) %}
|
|
|
|
|
<tbody class="table-row-group" {% if id %}id="{{id}}"{% endif %}>
|
|
|
|
|
{{ caller() }}
|
2016-11-14 16:00:45 +00:00
|
|
|
</tbody>
|
2016-11-14 14:46:26 +00:00
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
|
|
{% macro field(align='left', status='', border=True) -%}
|
|
|
|
|
|
|
|
|
|
{% set field_alignment = 'table-field-right-aligned' if align == 'right' else 'table-field-center-aligned' %}
|
|
|
|
|
{% set border = '' if border else 'table-field-noborder' %}
|
|
|
|
|
|
|
|
|
|
<td class="{{ [field_alignment, border]|join(' ') }}">
|
|
|
|
|
<span class="{{ 'table-field-status-' + status if status }}">{{ caller() }}</span>
|
|
|
|
|
</td>
|
2015-12-10 17:54:05 +00:00
|
|
|
{%- endmacro %}
|
2015-12-17 11:14:19 +00:00
|
|
|
|
2016-06-08 13:41:02 +01:00
|
|
|
{% macro row_heading() -%}
|
|
|
|
|
<th class="table-field">
|
|
|
|
|
<span>{{ caller() }}</span>
|
|
|
|
|
</th>
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-04-05 11:16:29 +01:00
|
|
|
{% macro index_field(text) -%}
|
|
|
|
|
<td class="table-field-index">
|
|
|
|
|
<span>{{ text }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-08-22 14:05:42 +01:00
|
|
|
{% macro text_field(text, status='') -%}
|
|
|
|
|
{% call field(status=status) %}
|
2016-02-19 15:02:13 +00:00
|
|
|
{{ text }}
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-04-12 15:05:27 +01:00
|
|
|
{% macro link_field(text, link) -%}
|
|
|
|
|
{% call field() %}
|
|
|
|
|
<a href="{{ link }}">{{ text }}</a>
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-08-22 13:49:41 +01:00
|
|
|
{% macro edit_field(text, link) -%}
|
|
|
|
|
{% call field(align='right') %}
|
|
|
|
|
<a href="{{ link }}">{{ text }}</a>
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
2016-02-19 15:02:13 +00:00
|
|
|
{% macro boolean_field(yes) -%}
|
|
|
|
|
{% call field(status='yes' if yes else 'no') %}
|
|
|
|
|
{{ "Yes" if yes else "No" }}
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{%- 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 %}
|
2016-09-09 15:40:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
{% macro notification_status_field(notification) %}
|
|
|
|
|
{% call field(status=notification.status|format_notification_status_as_field_status, align='right') %}
|
|
|
|
|
{% if notification.status|format_notification_status_as_url %}
|
|
|
|
|
<a href="{{ notification.status|format_notification_status_as_url }}">
|
|
|
|
|
{% endif %}
|
|
|
|
|
{{ notification.status|format_notification_status(
|
|
|
|
|
notification.template.template_type
|
|
|
|
|
) }}
|
|
|
|
|
{% if notification.status|format_notification_status_as_url %}
|
|
|
|
|
</a>
|
|
|
|
|
{% endif %}
|
|
|
|
|
<span class="status-hint">
|
|
|
|
|
{{ notification.status|format_notification_status_as_time(
|
2016-09-09 15:57:05 +01:00
|
|
|
notification.created_at|format_datetime_short,
|
2016-09-09 15:40:27 +01:00
|
|
|
(notification.updated_at or notification.created_at)|format_datetime_short
|
|
|
|
|
) }}
|
|
|
|
|
</span>
|
|
|
|
|
{% endcall %}
|
|
|
|
|
{% endmacro %}
|