mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 17:06:09 +00:00
On a phone the settings page opened with its group index on seven lines, and the index was gone once the page, nine screens long, was scrolled. Below the lg breakpoint it is now one row that scrolls sideways and sticks under the navbar (navbar_height.js gives what sticks the navbar's height, which differs between themes and grows when the phone menu opens). Turkish said "VM" in 65 messages and "sanal makine" everywhere else; it now says "sanal makine" throughout. Headings and buttons that still capitalised every word follow the panel's sentence case, in English too (Change password, SSH keys, Power off, ...). Wrong translations fixed: a password that is set read as the command "Ayarla", the firmware setting was called a chip type, Create flavor said Create user, the console viewport setting was called a port, a DRBD typo, and host and interface are sunucu and arabirim as on every page. A group's save button reads "Kaydet: <group>".
124 lines
7.5 KiB
HTML
124 lines
7.5 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "Edit settings" %}{% endblock title %}
|
|
|
|
{% block page_heading %}{% trans "Edit settings" %}{% endblock page_heading %}
|
|
|
|
{% block style %}
|
|
<style>
|
|
/* a group's card stops below the sticky navbar; the group index stays in view: beside the
|
|
groups, or on a narrow screen as one row under the navbar that scrolls sideways */
|
|
.settings-group { scroll-margin-top: 5rem; }
|
|
@media (min-width: 992px) {
|
|
.settings-index { position: sticky; top: 5rem; }
|
|
}
|
|
@media (max-width: 991.98px) {
|
|
/* the column sticks: the index alone would only stick within it */
|
|
.settings-index-column {
|
|
position: sticky;
|
|
top: var(--navbar-height, 4rem);
|
|
z-index: 1000;
|
|
background: var(--bs-body-bg);
|
|
padding-block: .5rem;
|
|
}
|
|
/* the padding keeps a link's focus ring inside the scrolling row */
|
|
.settings-index .nav { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding: .25rem; }
|
|
/* below the navbar and the index, whose height the theme and a scrollbar set */
|
|
.settings-group { scroll-margin-top: calc(var(--navbar-height, 4rem) + 6rem); }
|
|
}
|
|
</style>
|
|
{% endblock style %}
|
|
|
|
{% block content %}
|
|
<div class="row g-4">
|
|
<div class="col-lg-3 settings-index-column">
|
|
<nav class="settings-index" aria-label="{% trans 'Settings groups' %}">
|
|
<div class="nav nav-pills flex-lg-column gap-1">
|
|
<a class="nav-link" href="#appearance">{% trans "Appearance" %}</a>
|
|
{% for title, settings in groups %}
|
|
<a class="nav-link" href="#{{ title|slugify }}">{% trans title %}</a>
|
|
{% endfor %}
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
<div class="col-lg-9">
|
|
<section class="card mb-3 settings-group" id="appearance" aria-labelledby="appearance-heading">
|
|
<div class="card-header"><h2 class="h5 mb-0" id="appearance-heading">{% trans "Appearance" %}</h2></div>
|
|
<div class="card-body row g-3">
|
|
<form action="{% url 'set_language' %}" method="post" class="col-md-6">{% csrf_token %}
|
|
<label class="form-label" for="language">{% trans "Language" %}</label>
|
|
<select id="language" name="language" class="form-select" aria-describedby="language-help">
|
|
{% get_current_language as LANGUAGE_CODE %}
|
|
{% get_available_languages as LANGUAGES %}
|
|
{% get_language_info_list for LANGUAGES as languages %}
|
|
{% for language in languages %}
|
|
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>{{ language.name_local }} ({{ language.code }})</option>
|
|
{% endfor %}
|
|
</select>
|
|
<div id="language-help" class="form-text">{% trans "Yours only, in this browser" %}</div>
|
|
<button type="submit" class="btn btn-sm btn-outline-primary mt-2">{% trans "Change language" %}</button>
|
|
</form>
|
|
<form method="post" class="col-md-6">{% csrf_token %}
|
|
<label class="form-label" for="theme">{% trans bootstrap_theme.name %}</label>
|
|
<select id="theme" class="form-select" name="{{ bootstrap_theme.key }}" aria-describedby="theme-help">
|
|
{% for theme in themes_list %}
|
|
<option value="{{ theme }}"{% if bootstrap_theme.value == theme %} selected{% endif %}>{{ theme }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<div id="theme-help" class="form-text">{% trans "For every user" %}</div>
|
|
<button type="submit" class="btn btn-sm btn-outline-primary mt-2">{% trans "Change theme" %}</button>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
{% for title, settings in groups %}
|
|
{% trans title as group_title %}
|
|
<section class="card mb-3 settings-group" id="{{ title|slugify }}" aria-labelledby="group-{{ forloop.counter }}">
|
|
<div class="card-header"><h2 class="h5 mb-0" id="group-{{ forloop.counter }}">{{ group_title }}</h2></div>
|
|
<form method="post" class="card-body">{% csrf_token %}
|
|
<div class="row g-3">
|
|
{% for setting in settings %}
|
|
<div class="col-md-6">
|
|
{% if setting.choices == "True,False" %}
|
|
{# an unchecked box posts nothing: the hidden False goes first, a checked box's True wins #}
|
|
<input type="hidden" name="{{ setting.key }}" value="False">
|
|
<div class="form-check form-switch">
|
|
<input id="setting-{{ setting.key }}" class="form-check-input" type="checkbox" role="switch" name="{{ setting.key }}" value="True"
|
|
{% if setting.value == "True" %}checked {% endif %}aria-describedby="help-{{ setting.key }}">
|
|
<label class="form-check-label" for="setting-{{ setting.key }}">{% trans setting.name %}</label>
|
|
</div>
|
|
{% else %}
|
|
<label class="form-label" for="setting-{{ setting.key }}">{% trans setting.name %}</label>
|
|
{% if setting.choices %}
|
|
<select id="setting-{{ setting.key }}" class="form-select" name="{{ setting.key }}" aria-describedby="help-{{ setting.key }}">
|
|
{% for choice in setting.choices_as_list %}
|
|
<option value="{{ choice }}"{% if setting.value == choice %} selected{% endif %}>{% trans choice %}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{% elif setting.bounds %}
|
|
<input id="setting-{{ setting.key }}" class="form-control" type="number" name="{{ setting.key }}" value="{{ setting.value }}"
|
|
min="{{ setting.bounds.0 }}" max="{{ setting.bounds.1 }}" step="1" required aria-describedby="help-{{ setting.key }}">
|
|
{% else %}
|
|
<input id="setting-{{ setting.key }}" class="form-control" type="text" name="{{ setting.key }}" value="{{ setting.value }}"
|
|
maxlength="255" aria-describedby="help-{{ setting.key }}">
|
|
{% endif %}
|
|
{% endif %}
|
|
<input type="hidden" name="was-{{ setting.key }}" value="{{ setting.value }}">
|
|
<div id="help-{{ setting.key }}" class="form-text">{% trans setting.description %}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="border-top mt-3 pt-3 d-flex flex-wrap justify-content-end gap-2">
|
|
{# Save first: Enter in a field saves #}
|
|
<button type="submit" class="btn btn-primary">{% blocktrans %}Save {{ group_title }}{% endblocktrans %}</button>
|
|
{% if title == "Alerts" %}{# to the addresses and webhook saved #}
|
|
<button type="submit" name="test_alert" value="1" class="btn btn-outline-secondary order-first" formnovalidate>{% trans "Send a test alert" %}</button>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
</section>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|