added theme editor

This commit is contained in:
2026-02-19 13:39:19 +01:00
parent 4340a58450
commit a027cf8c1c
3 changed files with 89 additions and 0 deletions
+7
View File
@@ -71,6 +71,7 @@
<tr>
<th>Name</th>
<th>Datei</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
@@ -78,6 +79,12 @@
<tr>
<td>{{ sb.name }}</td>
<td><code>{{ sb.filename }}</code></td>
<td>
<a href="{{ url_for('admin.admin_edit_theme', filename=sb.filename) }}"
class="btn btn-sm btn-primary">
<i class="bi bi-pencil"></i> Bearbeiten
</a>
</td>
</tr>
{% endfor %}
</tbody>
+48
View File
@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block title %}Bearbeite Theme {{ filename }}{% endblock %}
{% block content %}
<div class="container my-5">
<h1>Bearbeite Soundboard-Theme</h1>
<h4 class="text-muted mb-4">{{ filename }}</h4>
{% if error %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ error }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
<form method="POST">
<div class="mb-3">
<label for="config_content" class="form-label">JSON-Inhalt (Theme):</label>
<textarea class="form-control font-monospace" id="config_content" name="config_content" rows="24">{{ content }}</textarea>
</div>
<div class="d-flex gap-3">
<button type="submit" class="btn btn-primary btn-lg px-5">Speichern</button>
<a href="{{ url_for('admin.admin') }}" class="btn btn-outline-secondary btn-lg px-5">Abbrechen</a>
</div>
</form>
<div class="mt-4">
<h5>Beispielstruktur (Theme)</h5>
<pre class="bg-light p-3 rounded">
{
"name": "Wilder Westen",
"backgrounds": [
{"id": "wind", "file": "wind.mp3", "loop": true, "channel": 0}
],
"sounds": [
{"id": "pfeife", "file": "pfeife.mp3", "channel": 2}
],
"random_pool": [
{"id": "durchsage1", "file": "durchsage1.mp3"}
],
"random_limit_per_hour": 2,
"random_window_minutes": 60
}
</pre>
</div>
</div>
{% endblock %}