{% from "partials/components/ui_macros.html" import modal_title, modal_footer %} {# core/ui/templates/partials/settings_modal.html Generisches Modul-Settings-Modal. Wird per HTMX in eingefügt (hx-swap="beforeend"). Variablen: mod – Module-Instanz (core.ui.Module) schema – list von field-dicts (key, label, type, options, default, description) values – dict {field_key: current_value} Field-Typen: text, password, number, select, checkbox, textarea, list Section-Attribute: cols (Anzahl Spalten im Grid) Field-Attribute: span (belegte Spalten im Section-Grid), width #} {% set modal_w = mod.settings_modal_width | default(480) %}
{{ modal_title(title=mod.label + " – Einstellungen", icon="settings") }}
{% set ns = namespace(grid_open=False, grid_cols=1, first_section=True) %} {% for field in schema %} {% set ftype = field.get('type', 'text') %} {% if ftype == 'section' %} {# Vorheriges Grid schließen #} {% if ns.grid_open %}
{% endif %}
{{ field.label }}
{% set ns.first_section = False %} {% set ns.grid_cols = field.get('cols', 1) %}
{% set ns.grid_open = True %} {% else %} {# Felder vor der ersten Section → 1-spaltiges Grid #} {% if not ns.grid_open %}
{% set ns.grid_open = True %} {% endif %} {% set fkey = field.key %} {% set fval = values.get(fkey, field.get('default', '')) %} {% set field_span = field.get('span', 1) %} {% if field_span > 1 %}
{% endif %}
{% if ftype == 'select' %} {% elif ftype == 'checkbox' %} {% elif ftype == 'list' %} {% set flist = fval if fval is iterable and fval is not string else [] %}
{% elif ftype == 'textarea' %} {% elif ftype == 'password' %} {% else %}{# text, number, etc. #} {% endif %} {% if field.get('description') %} {{ field.description }} {% endif %}
{% if field_span > 1 %}
{% endif %} {% endif %} {% endfor %} {% if ns.grid_open %}
{% endif %} {{ modal_footer(has_toggle=False, save_label="Speichern", save_type="submit") }}