mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
Add table of recipients
Uses an adapted version of the 'summary table' pattern from Digital Marketplace frontend toolkit: http://alphagov.github.io/digitalmarketplace-frontend-toolkit/summary-table.html
This commit is contained in:
39
app/templates/components/table.html
Normal file
39
app/templates/components/table.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{% macro table(items, caption='', field_headings='', field_headings_visible=True) -%}
|
||||
<table class="table">
|
||||
<caption class="heading-medium table-heading">
|
||||
{{ 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>
|
||||
{% if items %}
|
||||
{% for item in items %}
|
||||
<tr class="table-row">
|
||||
{{ caller(item) }}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="table-no-content">
|
||||
{{ empty_message }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro field(first=False, wide=False, action=False) -%}
|
||||
<td class="table-field{% if first %}-first{% endif %}{% if first and wide %}-wider{% endif %}{% if action %}-with-action{% endif %}">
|
||||
<span>{{ caller() }}</span>
|
||||
</td>
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user