Files
FireworksApp/members/templates/members/user_settings.html
T

56 lines
3.1 KiB
HTML

{% load i18n vite %}
<!doctype html>
<html lang="{{ request.LANGUAGE_CODE }}" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% trans "Settings · Sound Signal" %}</title>
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.4/dist/htmx.min.js"></script>
{% vite_asset "frontend/src/entries/settings.js" %}
{% include "js_translations.html" %}
</head>
<body>
<main class="settings-shell">
{% include "fireworks_detect/includes/navigation.html" %}
<div class="settings-content">
<div class="settings-heading">
<p class="eyebrow">{% trans "Your preferences" %}</p>
<h1>{% trans "Settings" %}</h1>
<p class="intro">{% trans "Manage your personal preferences." %}</p>
</div>
{% if messages %}<ul class="messages" role="status">{% for message in messages %}<li class="alert alert--success">{{ message }}</li>{% endfor %}</ul>{% endif %}
<form class="card settings-form" method="post" action="{% url 'user_settings' %}">
{% csrf_token %}
<h2 id="language-title">{% trans "Language" %}</h2>
<div class="field">
<label for="{{ language_form.preferred_language.id_for_label }}">{% trans "Preferred language" %}</label>
{{ language_form.preferred_language }}
{{ language_form.preferred_language.errors }}
</div>
<button class="button" type="submit" name="save_language" value="1">{% trans "Save language" %}</button>
</form>
<form class="card settings-form" method="post" action="{% url 'user_settings' %}">
{% csrf_token %}
<h2 id="ntfy-title">{% trans "Notifications / ntfy" %}</h2>
<p class="help">{% trans "Use a topic URL from your ntfy server. Test the URL before enabling notifications." %}</p>
<div class="field">
<label for="ntfy-url">{% trans "Topic URL" %}</label>
{{ form.ntfy_url }}
{{ form.ntfy_url.errors }}
</div>
<label class="switch-row" for="{{ form.ntfy_enabled.id_for_label }}">
<span class="switch-copy"><strong>{% trans "Enable ntfy notifications" %}</strong><small>{% trans "Save below to apply this change." %}</small></span>
<span class="switch-control">{{ form.ntfy_enabled }}<span class="switch-track" aria-hidden="true"></span></span>
</label>
<button class="button button--secondary" type="button" hx-post="{% url 'ntfy_test_notification' %}" hx-include="#ntfy-url, [name='csrfmiddlewaretoken']" hx-target="#ntfy-test-result" hx-swap="innerHTML">{% trans "Test notification" %}</button>
<div id="ntfy-test-result" aria-live="polite"></div>
<button class="button" type="submit">{% trans "Save settings" %}</button>
</form>
<section class="card" id="sensor-card" aria-labelledby="sensors-title">
<div id="sensor-card-content">{% include "members/partials/sensor_list.html" %}</div>
</section>
</div>
</main>
</body>
</html>