{# Shared template components. #} {# CSRF token of every POST form. #} {% macro csrf_field() -%}{%- endmacro %} {# Date and time: UTC text without JS, converted to the browser's local time otherwise. #} {% macro when(value, kind="full") -%} {%- if value -%}{%- endif -%} {%- endmacro %} {# One-click action button, with confirmation if `confirm` is given. #} {% macro action(url, label, confirm="", kind="", small=true) -%}
{{ csrf_field() }}
{%- endmacro %} {# Copyable value (address, command, secret). #} {% macro copyable(id, value, block=false) -%} {{ value }} {%- endmacro %} {# Secret shown only once. #} {% macro reveal_notice(value, message) -%}

{{ message }}

{{ copyable('revealed-value', value) }}

{%- endmacro %} {# Secondary navigation of a settings area (tabs). #} {% macro section_tabs(label, items, current) -%} {%- endmacro %} {# Danger zone: deletion confirmed by retyping the identifier (works without JS). #} {% macro danger_zone(title, text, url, slug, disabled_reason="") -%}

{{ title }}

{{ text }}

{% if disabled_reason %}

{{ disabled_reason }}

{% else %}
{{ csrf_field() }}
{% endif %}
{%- endmacro %} {# List of accounts suggested in a "username" field. #} {% macro people_list(id, people) -%} {% for username, display_name in people %}{% endfor %} {%- endmacro %} {# Restrictions of a token or an OAuth connection: read-only, chosen spaces. Member of several organizations: by default, only the spaces of the first one (`spaces` is sorted by organization). Otherwise, a page from one organization could lead the assistant to read another organization and copy its content. "All" remains an explicit choice. A single organization: all spaces, as before. #} {% macro access_limits(spaces, error=none) -%} {% set orgs = spaces|map(attribute="org_id")|unique|list %} {% set narrowed = orgs|length > 1 %}
{{ _("Permissions") }}
{{ _("Spaces") }} {% for s in spaces %}{% else %}

{{ _("You are not a member of any space.") }}

{% endfor %} {% if error %}{% endif %}
{% if narrowed %}

{{ _("You belong to several organizations: only the spaces of {org} are checked. Otherwise, malicious content in one organization could lead the assistant to read another organization and copy what it finds there. Check other spaces, or choose “All my spaces”, if you need them.", org=spaces[0].organization.name) }}

{% endif %} {%- endmacro %} {# After a refusal for a likely secret: confirm it is not one. #} {% macro secret_confirm(error) -%} {% if error and error.code == 'secret_detected' %}{% endif %} {%- endmacro %} {# Translated file field (the native button follows the browser language, not the page's). #} {# File field. Several files: each selection adds to the list above the button (preferences.js), each file can be removed; without JS, a plain multiple field. #} {% macro file_input(id, name, multiple=false, required=false) -%} {% if multiple %}{% endif %} {%- endmacro %}