updated editors + new parameter in service file

This commit is contained in:
2026-10-05 16:48:29 +02:00
parent 2e311119b0
commit 1a28a27b5e
8 changed files with 496 additions and 87 deletions
+42 -37
View File
@@ -1,48 +1,53 @@
{% extends "base.html" %}
{% block title %}Bearbeite Theme {{ filename }}{% endblock %}
{% block title %}Soundboard-Editor – {{ filename }}{% endblock %}
{% block content %}
<div class="container my-5">
<h1>Bearbeite Soundboard-Theme</h1>
<h4 class="text-muted mb-4">{{ filename }}</h4>
<div class="editor-shell" data-editor="soundboard">
<div class="editor-hero soundboard-hero">
<div><span class="editor-kicker">Soundboard Theme</span><h1>Klangwelt gestalten</h1><p>{{ filename }} · Sounds hinzufügen, verschieben und ihre Wiedergabe festlegen.</p></div>
<div class="d-flex gap-2 flex-wrap"><button type="button" class="btn btn-outline-light" id="show-raw-json">JSON anzeigen</button><button type="submit" form="theme-form" class="btn btn-warning px-4">Theme speichern</button></div>
</div>
{% 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 %}
{% if error %}<div class="alert alert-danger">{{ error }}</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>
<form id="theme-form" method="POST">
<textarea class="d-none" id="config_content" name="config_content">{{ content }}</textarea>
<section class="editor-panel mb-4">
<div class="editor-section-title"><span>01</span><div><h2>Theme-Einstellungen</h2><p>Name und Standardwerte für die Zufallswiedergabe</p></div></div>
<div class="row g-3">
<div class="col-md-6"><label class="form-label">Theme-Name</label><input id="theme-name" class="form-control form-control-lg"></div>
<div class="col-md-3"><label class="form-label">Max. Wiederholungen</label><input id="theme-limit" type="number" min="1" class="form-control form-control-lg"></div>
<div class="col-md-3"><label class="form-label">Zeitraum in Minuten</label><input id="theme-window" type="number" min="1" class="form-control form-control-lg"></div>
</div>
</section>
<section class="editor-panel mb-4">
<div class="editor-section-title compact"><span>02</span><div><h2>Neues Klangelement</h2><p>In einen Bereich ziehen oder zum Hinzufügen anklicken</p></div></div>
<div id="sound-palette" class="sound-palette">
<button type="button" draggable="true" data-sound-kind="background" class="sound-kind background"><strong>Hintergrund</strong><small>Endlosschleife</small></button>
<button type="button" draggable="true" data-sound-kind="sound" class="sound-kind effect"><strong>Einzelsound</strong><small>Manuell abspielen</small></button>
<button type="button" draggable="true" data-sound-kind="random" class="sound-kind random"><strong>Zufallssound</strong><small>Automatischer Pool</small></button>
</div>
</section>
<div class="theme-lanes">
<section class="sound-lane background-lane"><div class="lane-heading"><span class="lane-icon">∞</span><div><h2>Hintergrund</h2><p>Läuft als Loop auf einem festen Kanal</p></div></div><div class="lane-dropzone" data-dropzone="backgrounds"></div></section>
<section class="sound-lane effect-lane"><div class="lane-heading"><span class="lane-icon">▶</span><div><h2>Einzelsounds</h2><p>Gezielt über einen Button abspielen</p></div></div><div class="lane-dropzone" data-dropzone="sounds"></div></section>
<section class="sound-lane random-lane"><div class="lane-heading"><span class="lane-icon">⤨</span><div><h2>Zufallspool</h2><p>Wird durch die Soundboard-Automatik gewählt</p></div></div><div class="lane-dropzone" data-dropzone="random_pool"></div></section>
</div>
<div class="d-flex justify-content-between align-items-center mt-4"><a href="{{ url_for('admin.admin') }}" class="btn btn-outline-secondary">Abbrechen</a><button type="submit" class="btn btn-warning btn-lg px-5">Theme speichern</button></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 class="modal fade" id="rawJsonModal" tabindex="-1"><div class="modal-dialog modal-xl"><div class="modal-content"><div class="modal-header"><h5 class="modal-title">Erweiterte JSON-Ansicht</h5><button type="button" class="btn-close" data-bs-dismiss="modal"></button></div><div class="modal-body"><p class="text-muted">Die JSON-Ansicht bleibt für Sonderfelder und spätere Erweiterungen verfügbar.</p><textarea id="raw-json-editor" class="form-control font-monospace" rows="24"></textarea><div id="raw-json-error" class="text-danger mt-2"></div></div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Schließen</button><button type="button" id="apply-raw-json" class="btn btn-dark">JSON übernehmen</button></div></div></div></div>
</div>
<script type="application/json" id="editor-data">{{ theme_data|tojson }}</script>
<script type="application/json" id="sound-files-data">{{ sound_files|tojson }}</script>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/admin-config-editors.js') }}"></script>
{% endblock %}