styles geändert

This commit is contained in:
2025-02-19 21:01:55 +01:00
parent 2b53b40778
commit 209a23509b
5 changed files with 152 additions and 169 deletions

View File

@@ -1,149 +1,148 @@
<!-- templates/admin.html -->
{% extends "base.html" %}
{% block title %}Admin-Bereich{% endblock %}
{% block content %}
<div class="container mx-auto p-4 sm:p-6 lg:p-8">
<h1 class="text-3xl font-bold mb-6">Admin-Bereich</h1>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="bg-{{category}}-500 text-white p-2 rounded mb-2">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Benutzer anlegen -->
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">Neuen Benutzer anlegen</h2>
<form method="POST" action="{{ url_for('admin_panel') }}" class="space-y-4">
<div>
<label class="block mb-1">Benutzername</label>
<input type="text" name="new_username" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="block mb-1">Passwort</label>
<input type="password" name="new_password" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="inline-flex items-center">
<input type="checkbox" name="new_is_admin" class="form-checkbox h-5 w-5 text-blue-600" />
<span class="ml-2">Als Admin markieren</span>
</label>
</div>
<button type="submit" class="bg-green-500 text-white py-2 px-4 rounded hover:bg-green-600">
Erstellen
</button>
</form>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin-Bereich</title>
<style>
body {
background-color: black !important;
color: white !important;
font-family: Arial, sans-serif !important;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
max-width: 800px;
width: 100%;
padding: 20px;
background-color: #222 !important;
border-radius: 10px !important;
}
.title {
text-align: center;
font-size: 24px !important;
}
.form-group {
margin-bottom: 15px;
}
input, select, button {
width: 100% !important;
padding: 8px !important;
border-radius: 5px !important;
margin-top: 5px !important;
}
button {
background-color: green !important;
color: white !important;
border: none !important;
cursor: pointer;
}
button:hover {
background-color: darkgreen !important;
}
table {
width: 100% !important;
border-collapse: collapse !important;
margin-top: 10px !important;
}
th, td {
padding: 10px !important;
border-bottom: 1px solid gray !important;
text-align: left !important;
}
th {
background-color: #333 !important;
}
.danger-button {
background-color: red !important;
}
.danger-button:hover {
background-color: darkred !important;
}
.link-button {
display: block !important;
background-color: blue !important;
color: white !important;
text-align: center !important;
padding: 10px !important;
border-radius: 5px !important;
margin-top: 20px !important;
text-decoration: none !important;
}
</style>
</head>
<body>
<div class="container">
<h1 class="title">Admin-Bereich</h1>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div style="background-color: {{category}} !important; color: white !important; padding: 10px !important; border-radius: 5px !important; margin-bottom: 10px !important;">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div>
<h2>Neuen Benutzer anlegen</h2>
<form method="POST" action="{{ url_for('admin_panel') }}">
<div class="form-group">
<label>Benutzername:</label>
<input type="text" name="new_username" required>
</div>
<div class="form-group">
<label>Passwort:</label>
<input type="password" name="new_password" required>
</div>
<div class="form-group">
<label>
<input type="checkbox" name="new_is_admin"> Als Admin markieren
</label>
</div>
<button type="submit">Erstellen</button>
</form>
</div>
<div>
<h2>Benutzerverwaltung</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Username</th>
<th>Admin?</th>
<th>Aktion</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>{{ u.id }}</td>
<td>{{ u.username }}</td>
<td>{{ 'Ja' if u.is_admin else 'Nein' }}</td>
<td>
{% if u.id != session.user_id %}
<form method="POST" action="{{ url_for('delete_user', user_id=u.id) }}" onsubmit="return confirm('Benutzer wirklich löschen?')">
<button class="danger-button">Löschen</button>
</form>
{% else %}
<span style="color: gray !important;">[Eigener Account]</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<a href="{{ url_for('dashboard') }}" class="link-button">Zurück zum Dashboard</a>
</div>
<!-- Benutzerübersicht -->
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">Benutzerverwaltung</h2>
<table class="w-full table-auto">
<thead>
<tr class="border-b">
<th class="px-2 py-1">ID</th>
<th class="px-2 py-1">Username</th>
<th class="px-2 py-1">Admin?</th>
<th class="px-2 py-1"></th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr class="border-b">
<td class="px-2 py-1">{{ u.id }}</td>
<td class="px-2 py-1">{{ u.username }}</td>
<td class="px-2 py-1">{{ 'Ja' if u.is_admin else 'Nein' }}</td>
<td class="px-2 py-1 text-right">
{% if u.id != session.user_id %}
<form method="POST" action="{{ url_for('delete_user', user_id=u.id) }}" onsubmit="return confirm('Benutzer wirklich löschen?')">
<button class="bg-red-500 text-white px-2 py-1 rounded hover:bg-red-600 text-sm">
Löschen
</button>
</form>
{% else %}
<span class="text-xs text-gray-400">[Eigener Account]</span>
{% endif %}
<a href="{{ url_for('manage_bookmarks', user_id=u.id) }}" class="ml-3 bg-blue-500 text-white px-2 py-1 rounded hover:bg-blue-600 text-sm">
Lesezeichen
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Benachrichtigung erstellen -->
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">Benachrichtigung erstellen</h2>
<form method="POST" action="{{ url_for('add_notification') }}" class="space-y-4">
<div>
<label class="block mb-1">Nachricht</label>
<textarea name="message" class="p-2 border rounded w-full" rows="2" required></textarea>
</div>
<div>
<label class="block mb-1">Für Benutzer</label>
<select name="user_id" class="p-2 border rounded w-full">
<option value="all">Alle</option>
{% for u in users %}
<option value="{{ u.id }}">{{ u.username }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="bg-purple-500 text-white py-2 px-4 rounded hover:bg-purple-600">
Senden
</button>
</form>
</div>
<!-- Falls man Lesezeichen für EINEN User verwaltet -->
{% if single_user is defined and single_user %}
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">
Lesezeichen für {{ single_user.username }}
</h2>
<form method="POST" class="space-y-4">
<div>
<label class="block mb-1">Titel</label>
<input type="text" name="title" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="block mb-1">URL</label>
<input type="text" name="url" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="block mb-1">Icon (FontAwesome CSS-Klasse)</label>
<input type="text" name="icon_class" class="p-2 border rounded w-full" placeholder="z.B. fas fa-user">
</div>
<button type="submit" class="bg-green-500 text-white py-2 px-4 rounded hover:bg-green-600">
Hinzufügen
</button>
</form>
<!-- Tabelle der vorhandenen Bookmarks -->
<ul class="mt-4 space-y-2">
{% for bm in bookmarks %}
<li class="bg-gray-100 dark:bg-gray-700 p-2 rounded flex justify-between items-center">
<div>
<i class="{{ bm.icon_class }} mr-2"></i>
<a href="{{ bm.url }}" target="_blank" class="text-blue-600 hover:underline">{{ bm.title }}</a>
</div>
<form method="POST" action="{{ url_for('delete_bookmark', bookmark_id=bm.id, user_id=single_user.id) }}" onsubmit="return confirm('Lesezeichen wirklich löschen?')">
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash-alt"></i></button>
</form>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<a href="{{ url_for('dashboard') }}" class="inline-block bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">
Zurück zum Dashboard
</a>
</div>
{% endblock content %}
</body>
</html>