{% macro mapping_table(caption='', field_headings=[], field_headings_visible=True, caption_visible=True) -%} {% for field_heading in field_headings %} {% endfor %} {{ caller() }}
{{ caption }}
{% if field_headings_visible %} {{ field_heading }} {% else %} {{ field_heading }} {% endif %}
{%- endmacro %} {% macro list_table(items, caption='', empty_message='', field_headings=[], field_headings_visible=True, caption_visible=True) -%} {% set parent_caller = caller %} {% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %} {% for item in items %} {% call row(item.id) %} {{ parent_caller(item, loop.index + 1) }} {% endcall %} {% endfor %} {% if not items %} {% call row() %} {{ empty_message }} {% endcall %} {% endif %} {%- endcall %} {%- endmacro %} {% macro row(id=None) -%} {{ caller() }} {%- endmacro %} {% macro row_group(id=None) %} {{ caller() }} {%- 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' %} {{ caller() }} {%- endmacro %} {% macro row_heading() -%} {{ caller() }} {%- endmacro %} {% macro index_field(text) -%} {{ text }} {%- endmacro %} {% macro text_field(text, status='') -%} {% call field(status=status) %} {{ text }} {% endcall %} {%- endmacro %} {% macro link_field(text, link) -%} {% call field() %} {{ text }} {% endcall %} {%- endmacro %} {% macro edit_field(text, link) -%} {% call field(align='right') %} {{ text }} {% endcall %} {%- endmacro %} {% macro boolean_field(yes) -%} {% call field(status='yes' if yes else 'no') %} {{ "Yes" if yes else "No" }} {% endcall %} {%- endmacro %} {% macro right_aligned_field_heading(text) %} {{ text }} {%- endmacro %} {% macro hidden_field_heading(text) %} {{ text }} {%- endmacro %} {% 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 %} {% endif %} {{ notification.status|format_notification_status( notification.template.template_type ) }} {% if notification.status|format_notification_status_as_url %} {% endif %} {{ notification.status|format_notification_status_as_time( notification.created_at|format_datetime_short, (notification.updated_at or notification.created_at)|format_datetime_short ) }} {% endcall %} {% endmacro %}