Files
notifications-admin/app/templates/components/ajax-block.html
Chris Hill-Scott ccf520f446 Derive markup dashboard from rendered partials
This commit extends the `ajax_block` component to take a `dict` of
partials, from which it can select the partial matching its `key`
argument and print its HTML to the page.

This means that the same markup is only rendered in one place, rather
than in two (individually in the JSON endpoint and as `include`s in the
parent template).
2016-06-28 13:07:20 +01:00

16 lines
381 B
HTML

{% macro ajax_block(partials, url, key, interval=2, finished=False) %}
{% if not finished %}
<div
data-module="update-content"
data-resource="{{ url }}"
data-key="{{ key }}"
data-interval-seconds="{{ interval }}"
aria-live="polite"
>
{% endif %}
{{ partials[key]|safe }}
{% if not finished %}
</div>
{% endif %}
{% endmacro %}