mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
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).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{% macro ajax_block(url, key, interval=2, finished=False) %}
|
||||
{% macro ajax_block(partials, url, key, interval=2, finished=False) %}
|
||||
{% if not finished %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
@@ -8,7 +8,7 @@
|
||||
aria-live="polite"
|
||||
>
|
||||
{% endif %}
|
||||
{{ caller() }}
|
||||
{{ partials[key]|safe }}
|
||||
{% if not finished %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user