SielBotWebsite/templates/polls.html
Maaxxs 387d7bd80e Meldungen: Text und Knopf des Melde-Panels frei gestaltbar (Editor mit Vorschau, Platzhalter)
Platzhalter {leitung} {punkte} {schwelle} {stunden} {tage} zeigen die aktuellen
Werte; ein gepostetes Panel wird nach dem Speichern ohne neuen Ping angepasst.
Der Editor nimmt dafuer optional ctx.fill fuer eigene Platzhalter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 07:18:01 +02:00

89 lines
4.6 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% from "macros.html" import channel_select %}
{% block title %}Abstimmungen{% endblock %}
{% block content %}
<div class="page-head">
<h1>Abstimmungen</h1>
<p class="muted">Frage stellen, Antworten vorgeben, im Discord per Knopf abstimmen lassen. Schnell geht es auch mit <code>/abstimmung</code> direkt im Discord (für Moderatoren).</p>
</div>
{% if error %}<div class="flash flash-error">{{ error }}</div>{% endif %}
<section class="panel">
<h2>Laufende und beendete Abstimmungen</h2>
{% if polls %}
<div class="rr-list">
{% for p in polls %}
<div class="rr-row">
<div class="rr-main">
<a href="/abstimmungen/{{ p.id }}" class="rr-name">📊 {{ p.question }}</a>
<div class="muted small"># {{ p.channel_name or "?" }} · {{ p.options | length }} Antworten · {{ p.voters }} {{ "Person" if p.voters == 1 else "Personen" }} abgestimmt{% if p.anonymous %} · anonym{% endif %}</div>
{% if p.voters %}
{% set total = p.counts | sum %}
{% set top = p.counts | max %}
<div class="muted small">Vorne: {% for o in p.options %}{% if p.counts[loop.index0] == top %}<strong>{{ o.label }}</strong> ({{ (100 * top / total) | round | int }} %) {% endif %}{% endfor %}</div>
{% endif %}
</div>
<div class="rr-status">
{% if p.status == "open" %}<span class="tag tag-green">Läuft</span>
<div class="muted small">{% if p.ends_at %}bis {{ p.ends_at | datetime }}{% else %}ohne Ende{% endif %}</div>
{% else %}<span class="tag">Beendet</span>
<div class="muted small">{{ p.ended_at | datetime }}</div>{% endif %}
</div>
<div class="rr-actions">
<a href="/abstimmungen/{{ p.id }}" class="btn btn-sm btn-secondary">Ergebnis</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<p class="muted">Noch keine Abstimmung.</p>
{% endif %}
</section>
{% if guild %}
<script type="application/json" id="poll-data">{{ {"draft": draft, "roles": guild.roles} | tojson }}</script>
<form method="post" action="/abstimmungen/neu" class="panel" id="neu">
<input type="hidden" name="csrf" value="{{ csrf }}">
<input type="hidden" name="payload" id="poll-payload">
<h2>Neue Abstimmung</h2>
<div class="field-row">
<label class="field"><span>Kanal</span>
{{ channel_select("channel_id", guild.channels, None, empty="– Kanal wählen –") }}
</label>
<label class="field"><span>Dauer</span>
<select id="poll-duration">
{% for v, l in durations %}<option value="{{ v }}"{% if v == "86400" %} selected{% endif %}>{{ l }}</option>{% endfor %}
</select>
</label>
</div>
<label class="field field-wide"><span>Frage</span>
<input type="text" id="poll-question" maxlength="250" required placeholder="z. B. Welcher Tag passt euch für den nächsten Raid?">
</label>
<label class="field field-wide"><span>Beschreibung (optional)</span>
<textarea id="poll-description" rows="2" maxlength="1000"></textarea>
</label>
<div class="field field-wide"><span>Antworten (2 bis 10) – Emoji optional, ohne Emoji nummeriert Siel sie</span>
<div id="poll-options" class="poll-options"></div>
<button type="button" class="btn btn-sm btn-ghost" id="poll-add">+ Antwort hinzufügen</button>
</div>
<div class="field-row">
<label class="field"><span>Stimmen pro Person</span>
<input type="number" id="poll-max" min="1" max="10" value="1" class="input-sm">
</label>
<label class="field"><span>Rolle beim Start anpingen (optional)</span>
<select id="poll-ping"><option value="">– niemand –</option>
{% for r in guild.roles if not r.managed %}<option value="{{ r.id }}">{{ r.name }}</option>{% endfor %}
</select>
</label>
</div>
<label class="check"><input type="checkbox" id="poll-live" checked> Ergebnis schon während der Abstimmung zeigen</label><br>
<label class="check"><input type="checkbox" id="poll-anon"> Anonym – auch im Panel nicht zeigen, wer was gewählt hat</label>
<div class="field field-wide"><span>Nur diese Rollen dürfen abstimmen (keine gewählt = alle)</span>
<div class="role-list" id="poll-roles"></div>
</div>
<button type="submit" class="btn">Abstimmung starten</button>
</form>
<script src="/static/js/embed-editor.js?v=3"></script>
<script src="/static/js/polls.js?v=1"></script>
{% endif %}
{% endblock %}