{% endmacro %}
{#
flashed_messages: the shared alert list. A macro rather than a block so the
login page can render it inside its card -- a sign-in error banner at the
top of the page sits 10em above the form it belongs to.
#}
{% macro flashed_messages() %}
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% for category, message in messages %}
{% set mapping = {'message': 'info', 'error': 'danger'} %}
{% set variant = ' alert-' ~ mapping.get(category, category) if category else '' %}
{{ message }}
{% endfor %}
{% endif %}
{% endwith %}
{% endmacro %}
{#
utc_timestamp: renders a stored (naive UTC) datetime.
The attribute keeps the exact instant with its offset; the text is the wall
clock, to the second and unlabelled -- the zone is named once per page by
tz_indicator. The tooltip is that same instant written once, ISO-8601 to the
second with the offset of the zone the text is in, so a truncated cell's
tooltip still holds what was cut off. Rendered here in UTC, which is what the
text is without script; EportalUtils.renderTimestamps rewrites both the text
and the tooltip to the configured zone. base.html loads eportal-js/utils.js
on every page.
#}
{% macro utc_timestamp(value) -%}
{%- if value -%}
{%- endif -%}
{%- endmacro %}
{# The `datetime` and tooltip every rendered timestamp carries. #}
{% macro _timestamp_attrs(value) -%}
datetime="{{ value|utc_isoformat }}" title="{{ value|utc_isoformat(timespec='seconds') }}"
{%- endmacro %}
{#
utc_timestamp_tooltip: the caller's own text, with the instant on its
tooltip only -- utc_timestamp's tooltip, which renderTimestamps rewrites the
same way while leaving the text alone. For text that is about an instant but
is not one, such as a countdown to it.
#}
{% macro utc_timestamp_tooltip(value, class) -%}
{%- endmacro %}
{#
tz_indicator: names the zone every timestamp on the page is printed in.
Once per page, in the navbar: the zone is one fact per page, and a column
heading is too narrow for an IANA name. On every page, from base.html: the
values are UTC whether or not a page happens to print one, so there is
nothing for a page to opt into and nothing it can forget. The zone *name*,
never an abbreviation or a fixed offset: one page shows rows either side of
a DST boundary.
#}
{% macro tz_indicator() -%}