initial commit
This commit is contained in:
23
app/templates/base.html
Normal file
23
app/templates/base.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ title if title else "TK Wiki Newsletter Admin" }}</title>
|
||||
<link rel="stylesheet" href="/static/css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<h1>TK Wiki Newsletter Admin</h1>
|
||||
{% if user %}
|
||||
<form method="post" action="/logout">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</header>
|
||||
<main class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
124
app/templates/dashboard.html
Normal file
124
app/templates/dashboard.html
Normal file
@@ -0,0 +1,124 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<section class="card">
|
||||
<h2>Newsletter erstellen</h2>
|
||||
<form method="post" action="/dashboard" class="form-grid">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>Zeitraum (Tage)
|
||||
<input type="number" name="days" min="1" max="90" value="{{ filters.days }}">
|
||||
</label>
|
||||
<label>Kategorie (optional)
|
||||
<input type="text" name="category" value="{{ filters.category }}">
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="only_edited" value="true" {% if filters.only_edited %}checked{% endif %}>
|
||||
Nur bearbeitete Artikel (keine neu erstellten)
|
||||
</label>
|
||||
{% if user.role in ["admin", "editor"] %}
|
||||
<button type="submit">Newsletter generieren</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% if user.role == "admin" %}
|
||||
<p><a href="/admin/users">Zur Benutzerverwaltung</a></p>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
{% if user.role in ["admin", "editor"] %}
|
||||
<section class="card">
|
||||
<h3>Optionaler SMTP-Versand</h3>
|
||||
<form method="post" action="/newsletter/send-now" class="form-grid">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="days" value="{{ filters.days }}">
|
||||
<input type="hidden" name="category" value="{{ filters.category }}">
|
||||
<input type="hidden" name="only_edited" value="{{ 'true' if filters.only_edited else 'false' }}">
|
||||
<button type="submit">Newsletter jetzt senden</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if user.role == "admin" %}
|
||||
<section class="card">
|
||||
<h3>SMTP-Konfiguration (optional)</h3>
|
||||
<form method="post" action="/admin/smtp" class="form-grid">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="enabled" value="true" {% if smtp.enabled == "true" %}checked{% endif %}>
|
||||
SMTP Versand aktivieren
|
||||
</label>
|
||||
<label>SMTP Host
|
||||
<input type="text" name="host" value="{{ smtp.host }}">
|
||||
</label>
|
||||
<label>SMTP Port
|
||||
<input type="number" name="port" value="{{ smtp.port }}">
|
||||
</label>
|
||||
<label>Benutzername
|
||||
<input type="text" name="username" value="{{ smtp.username }}">
|
||||
</label>
|
||||
<label>Passwort
|
||||
<input type="password" name="password" value="{{ smtp.password }}">
|
||||
</label>
|
||||
<label>Absender E-Mail
|
||||
<input type="email" name="from_email" value="{{ smtp.from_email }}">
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="use_tls" value="true" {% if smtp.use_tls == "true" %}checked{% endif %}>
|
||||
STARTTLS verwenden
|
||||
</label>
|
||||
<label>Verteilerliste (Komma-separiert)
|
||||
<textarea rows="3" name="recipients">{{ smtp.recipients }}</textarea>
|
||||
</label>
|
||||
<label>Geplanter täglicher Versand (HH:MM)
|
||||
<input type="time" name="schedule_time" value="{{ smtp.schedule_time }}">
|
||||
</label>
|
||||
<button type="submit">SMTP Einstellungen speichern</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<section class="card">
|
||||
<h3>Output: Outlook Text</h3>
|
||||
<textarea rows="14" readonly>{{ plain_text }}</textarea>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h3>Output: Raw HTML</h3>
|
||||
<textarea rows="14" readonly>{{ raw_html }}</textarea>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h3>Gefundene Artikel ({{ articles|length }})</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Titel</th><th>Zeit</th><th>Benutzer</th><th>Kategorien</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in articles %}
|
||||
<tr>
|
||||
<td>{{ item.title }}</td>
|
||||
<td>{{ item.timestamp }}</td>
|
||||
<td>{{ item.user }}</td>
|
||||
<td>{{ item.categories|join(", ") }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h3>Versandprotokoll (letzte 20)</h3>
|
||||
<table>
|
||||
<thead><tr><th>Zeit</th><th>Status</th><th>Betreff</th><th>Empfänger</th><th>Details</th></tr></thead>
|
||||
<tbody>
|
||||
{% for log in send_logs %}
|
||||
<tr>
|
||||
<td>{{ log.created_at }}</td>
|
||||
<td>{{ log.status }}</td>
|
||||
<td>{{ log.subject }}</td>
|
||||
<td>{{ log.recipients }}</td>
|
||||
<td>{{ log.detail }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
{% endblock %}
|
||||
16
app/templates/login.html
Normal file
16
app/templates/login.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<section class="card narrow">
|
||||
<h2>Login</h2>
|
||||
<form method="post" action="/login" class="form-grid">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>E-Mail
|
||||
<input type="email" name="email" required>
|
||||
</label>
|
||||
<label>Passwort
|
||||
<input type="password" name="password" required>
|
||||
</label>
|
||||
<button type="submit">Anmelden</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
||||
43
app/templates/users.html
Normal file
43
app/templates/users.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<section class="card">
|
||||
<h2>Benutzerverwaltung</h2>
|
||||
<form method="post" action="/admin/users" class="form-grid">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>E-Mail
|
||||
<input type="email" name="email" required>
|
||||
</label>
|
||||
<label>Vollständiger Name
|
||||
<input type="text" name="full_name" required>
|
||||
</label>
|
||||
<label>Passwort
|
||||
<input type="password" name="password" required minlength="10">
|
||||
</label>
|
||||
<label>Rolle
|
||||
<select name="role">
|
||||
<option value="reader">Reader</option>
|
||||
<option value="editor">Editor</option>
|
||||
<option value="admin">Admin</option>
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit">Benutzer erstellen</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h3>Bestehende Benutzer</h3>
|
||||
<table>
|
||||
<thead><tr><th>E-Mail</th><th>Name</th><th>Rolle</th><th>Aktiv</th></tr></thead>
|
||||
<tbody>
|
||||
{% for u in users %}
|
||||
<tr>
|
||||
<td>{{ u.email }}</td>
|
||||
<td>{{ u.full_name }}</td>
|
||||
<td>{{ u.role }}</td>
|
||||
<td>{{ "Ja" if u.is_active else "Nein" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user