{# Shared per-rule toggle form. Used by issues / suggestions / storage-billing pages. Caller sets: - heading : page heading - subheading : page subheading - empty_message : message when ``rules`` is empty - form_action : POST URL the form submits to - rules : list of {rule_type, display_name, description, is_enabled} - saved : flash bool - errors : dict #}
{# Flash messages live above the card so they're not visually scoped to any one rule. #} {% if errors and errors.get('_general') %}
{{ errors['_general'] }}
{% endif %} {% if saved %}
Saved.
{% endif %} {% if not rules %} {# Empty state - heading still rendered, just no card. #}

{{ heading }}

{{ subheading }}

{{ empty_message }}

{% else %}
{# Single visible card with an UNBROKEN border. The page heading, subheading, and rule count are the first children inside, so the user reads them as the card's title block rather than a floating page header. We drop the ``
`` + ```` pattern here - legend visually punches a hole through the card's top border, which made the heading look like it was outside the card on every settings sub-page. The checkboxes remain grouped semantically inside the surrounding ````. #}

{{ heading }}

{{ subheading }}

{{ rules | length }} rule{{ '' if rules|length == 1 else 's' }} on this page

{% for rule in rules %} {% endfor %}

Changes apply on the next scan.

{% endif %}