Artberry-web/templates/panel.html
2025-02-16 16:38:57 +02:00

165 lines
7.6 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Админ Панель</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
<h1>Админ Панель</h1>
<h2>Управление Артами</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Файл</th>
<th>Пользователь</th>
<th>Теги</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for art in arts %}
<tr>
<td>{{ art.id }}</td>
<td>{{ art.image_file }}</td>
<td>{{ art.username }}</td>
<td>
<form action="{{ url_for('admin_update_tags', content_type='art', content_id=art.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="text" name="tags" value="{{ art.tags }}">
<button type="submit">Обновить</button>
</form>
</td>
<td>
<form action="{{ url_for('admin_delete_content', content_type='art', content_id=art.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" onclick="return confirm('Вы уверены, что хотите удалить этот арт?')">Удалить</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2>Управление Комментариями</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Текст комментария</th>
<th>Пользователь</th>
<th>Дата</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for comment in comments %}
<tr>
<td>{{ comment.id }}</td>
<td>
<form action="{{ url_for('admin_update_comment', comment_id=comment.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<textarea name="comment_text">{{ comment.comment_text }}</textarea>
<button type="submit">Обновить</button>
</form>
</td>
<td>{{ comment.username }}</td>
<td>{{ comment.comment_date }}</td>
<td>
<form action="{{ url_for('admin_delete_comment', comment_id=comment.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" onclick="return confirm('Вы уверены, что хотите удалить этот комментарий?')">Удалить</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2>Управление Видео</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Название</th>
<th>Пользователь</th>
<th>Теги</th>
<th>Описание</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for video in videos %}
<tr>
<td>{{ video.id }}</td>
<td>{{ video.video_name }}</td>
<td>{{ video.username }}</td>
<td>
<form action="{{ url_for('admin_update_video', content_id=video.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="text" name="tags" value="{{ video.tags }}">
<button type="submit">Обновить теги</button>
</form>
</td>
<td>
<form action="{{ url_for('admin_update_video', content_id=video.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="text" name="video_name" value="{{ video.video_name }}" placeholder="Новое название">
<textarea name="description" placeholder="Новое описание">{{ video.description }}</textarea>
<button type="submit">Обновить видео</button>
</form>
</td>
<td>
<form action="{{ url_for('admin_delete_content', content_type='video', content_id=video.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" onclick="return confirm('Вы уверены, что хотите удалить это видео?')">Удалить</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2>Управление Пользователями</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Имя пользователя</th>
<th>IP-адрес</th>
<th>Дата создания</th>
<th>Печеньки</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.username }}</td>
<td>{{ user.ip_address }}</td>
<td>{{ user.creation_date }}</td>
<td>{{ user_cookies[user.id] if user.id in user_cookies else 0 }}</td>
<td>
<form action="{{ url_for('admin_update_user', user_id=user.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="text" name="username" placeholder="Новый юзернейм" value="{{ user.username }}">
<input type="password" name="password" placeholder="Новый пароль">
<button type="submit">Обновить</button>
</form>
<form action="{{ url_for('admin_update_cookies', user_id=user.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="number" name="cookies" value="{{ user_cookies[user.id] if user.id in user_cookies else 0 }}">
<button type="submit">Обновить печеньки</button>
</form>
<form action="{{ url_for('admin_delete_user', user_id=user.id) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" onclick="return confirm('Вы уверены, что хотите удалить этого пользователя?')">Удалить</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>