{% extends "layouts/main.html" %} {#- «Settings» (admins): the access (role x area, with sign-in), the users' roles (with sign-in), the application's accounts (when a module names APP_ACCOUNT_TYPES; on /api/settings/accounts), «Dashboards» (Module.SCREENS; when there are any) with, below the list, the settings of the modules that declare them, a tab per other module with its own sections (Module.SETTINGS) and its settings of config.yaml (Module.CONFIG, generated from the manifest), and «Data»: what modules no longer delivered left behind (flaskspark.core.leftovers), to clean up. Script: flaskspark/settings.js. -#} {%- macro module_settings(tab) -%} {#- the module's own sections (Module.SETTINGS), above the generated form of its CONFIG #} {% for section in tab.sections %}{% include section %}{% endfor %} {% if tab.groups %}

{{ _("The defaults come from config.yaml; an empty field takes the default again.") }}

{% for group in tab.groups %}
{{ group.label or _("General") }}
{% for f in group.fields %}{{ field(f) }}{% endfor %}
{% endfor %}
{{ _("Save") }}
{% endif %} {%- endmacro %} {% block page_title %}{{ _("Settings") }}{% endblock %} {% from "flaskspark/icons.html" import icon %} {% macro field(f) %} {%- set label = f.label ~ (" (" ~ f.unit ~ ")" if f.unit else "") -%} {%- set bounds = (" · " ~ (f.min if f.min is not none else "…") ~ "–" ~ (f.max if f.max is not none else "…")) if (f.min is not none or f.max is not none) else "" -%} {%- set default = f.default_shown if f.kind not in ("bool", "choice") else ( (_("on") if f.default else _("off")) if f.kind == "bool" else ((f.choices | selectattr("value", "equalto", f.default_shown) | map(attribute="label") | first) or f.default_shown)) -%} {%- set format = {"time": _("HH:MM or «off»"), "ints": _("comma separated"), "texts": _("comma separated"), "json": "JSON"}.get(f.kind) -%} {%- set help = (f.help ~ " · " if f.help else "") ~ (format ~ " · " if format else "") ~ _("Default: %(value)s", value=(default if default != "" else _("empty"))) ~ bounds -%}
{% if f.kind == "bool" %} {% elif f.kind == "choice" %} {% for choice in f.choices %} {% endfor %} {% elif f.kind == "json" %} {% else %} {% set number = f.kind in ("int", "float") %} {% endif %} {% if f.changed %}
{{ _("Changed here") }} {{ _("Default") }}
{% endif %}
{% endmacro %} {% block content %}

{{ _("Settings") }}

{% if matrix %}

{{ _("Which role may use which area. Changes apply at once.") }}

{#- The roles are the columns, the areas the rows (many areas fit); the pages of an area (Area.parent) right below it, indented. #} {% for role in matrix.roles %} {% endfor %} {% for area in matrix.areas %} {% for role in matrix.roles %} {% endfor %} {% endfor %}
{{ _("Area") }}{{ role.name }}{% if role.admin %}
{{ _("always everything") }}{% endif %}
{{ area.label }} {% if area.description %}
{{ area.description }}{% endif %}

{{ _("The role comes from the sign-in (the identity provider's groups). An area or page without the right is invisible and closed; a page has its own right, independent of its area.") }}

{% endif %} {% if users is not none %}

{{ _("The role of each user. Changes apply at once.") }}

{% for u in users %} {% set own = u.id == me %} {% else %} {% endfor %}
{{ _("User") }}{{ _("E-mail") }}{{ _("Role") }}
{{ u.username }}{% if u.name %}
{{ u.name }}{% endif %}
{{ u.email }} {% for role in matrix.roles %} {% endfor %} {% if own %}{{ _("You can't change your own role.") }}{% endif %}
{{ _("No users yet.") }}

{{ _("«From the sign-in» takes the role the identity provider gives at every sign-in. A role chosen here applies at once and stays after later sign-ins, until it is set back. Users appear after their first sign-in.") }}

{% endif %} {% if app_accounts %} {% endif %} {% if screens %}

{{ _("The dashboards of the modules: pages for a display on the wall, without navigation and buttons. Open one on the display; ?mode=dark and ?scale=1.5 in the address fix the colour mode and the size there.") }}

{% for s in screens %} {% endfor %}
{{ _("Dashboard") }}{{ _("Module") }}{{ _("Area") }} {{ _("Colour mode") }}{{ _("Daily reload") }}{{ _("Address") }}
{{ icon(s.icon) }} {{ s.title }} {% if s.description %}
{{ s.description }}{% endif %} {% if not s.sections %}
{{ _("No module adds anything to it yet.") }}{% endif %}
{{ s.module }} {{ s.area }} {{ {"light": _("Light"), "dark": _("Dark"), "system": _("System")}.get(s.mode, _("As in the app")) }} {{ s.reload_at or _("never") }} {{ s.url }} {{ icon("box-arrow-up-right") }}

{{ _("A dashboard needs its area, like any other page; each module's section asks for its own.") }} {{ _("All dashboards") }}

{#- the settings of the modules that declare dashboards (instead of a tab of their own) #} {% for tab in screen_tabs %}
{{ module_settings(tab) }}
{% endfor %}
{% endif %} {% for tab in tabs %} {{ module_settings(tab) }} {% endfor %}

{{ _("What modules the application no longer delivers left behind, and settings nothing uses any more. FlaskSpark never removes them by itself; whatever is removed here is first backed up.") }}

{% if leftovers %} {% for item in leftovers %} {% endfor %}
{{ _("What") }}{{ _("Kind") }}{{ _("Details") }}{{ _("Clean up") }}
{{ item.title }} {{ item.kind_label }} {{ item.detail }} {{ _("Remove") }}
{{ _("Clean up all") }}
{% else %}

{{ _("Nothing left over.") }}

{% endif %}

{{ _("This deletes:") }}

    {{ _("It cannot be undone, except from the backup FlaskSpark makes first (its name follows after the clean-up).") }}
    {{ _("Cancel") }} {{ _("Remove") }}
    {% endblock %} {% block page_scripts %} {% if app_accounts %} {% endif %} {% endblock %}