{# Small shared parts. #} {% macro empty(text) %}
{{ text }}
{% endmacro %} {# The hidden field every form that changes something carries. #} {% macro csrf_field() %}{% endmacro %} {# A form that is only a button, e.g. "Delete", with a question before it. #} {% macro action(url, label, confirm=None, cls="small", fields={}) %}
{{ csrf_field() }} {% for name, value in fields.items() %}{% endfor %}
{% endmacro %} {# A labelled input. #} {% macro field(name, label, value="", type="text", hint=None, required=False, cls="", attrs="") %}
{% if hint %}{{ hint }}{% endif %}
{% endmacro %} {# The links below a list: to the next page, and from a later page back to the first. ``pages``: (more, first), as ``page_links`` gives them. #} {% macro pager(pages) %} {% set more, first = pages %} {% if more or first %}
{% if first %}Newest{% endif %} {% if more %}Older{% endif %}
{% endif %} {% endmacro %} {# The options of a folder select: the tree indented by depth, without the folders in ``exclude``. #} {% macro folder_options(tree, exclude, selected=None) %} {% for folder, depth in tree %}{% if folder.id not in exclude %}{% endif %}{% endfor %} {% endmacro %} {# The tag beside an account whose user may read mail there and send it to any address: what an injected instruction needs to carry data out. #} {% macro anywhere_tag() %}reads and sends anywhere{% endmacro %} {# The stored credentials of an account, one per line. #} {% macro credentials(stored) %}{% for credential in stored %}{{ credential.field }}, changed {{ credential.updated_at | when }}{% if not loop.last %}
{% endif %}{% else %}—{% endfor %}{% endmacro %} {# The card at the end of a page whose one button removes the thing. #} {% macro danger_card(title, text, url, label, confirm) %}

{{ title }}

{{ text }} {{ action(url, label, confirm=confirm, cls="danger") }}
{% endmacro %} {# A native dialog for a form loaded into #modal. #} {% macro modal(title) %}

{{ title }}

{{ caller() }}
{% endmacro %}