{# Form helpers for the console. Import with context so they can see the form token: {% import "_macros.html" as m with context %} #} {% macro guard(back) -%} {%- endmacro %} {# A form that posts to /ui/ and comes back to . Its fields are the caller's. #} {% macro post(action, back, cls="inline") -%}
{{ guard(back) }}{{ caller() }}
{%- endmacro %} {# An on/off switch that is its own small form: pressing it posts the opposite value. #} {% macro switch(action, back, on, label, fields, value_name="mcp", on_value="on", off_value="off", disabled=False, reason="", text=True) -%}
{{ guard(back) }} {%- for k, v in fields.items() %}{% endfor -%} {% if text %}{{ "on" if on else "off" }}{% endif %}
{%- endmacro %} {# A destructive button that asks first, with no script: a panel opens on hover or focus. #} {% macro confirm(action, back, label, question, yes, fields, icon="") -%} {%- endmacro %} {% macro icon_(name) -%}{%- endmacro %} {% macro icon(name) -%}{%- endmacro %}