mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
This is less repetitive than typing out the HTML with all its attributes every time. It also lets us wrap up the idea of ‘finished’ as a parameter, so the AJAX code will only be initiated when it’s needed, eg if a job is still processing.
16 lines
361 B
HTML
16 lines
361 B
HTML
{% macro ajax_block(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 %}
|
|
{{ caller() }}
|
|
{% if not finished %}
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|