techtalk/templates/admin_dashboard.html

39 lines
1.7 KiB
HTML
Raw Normal View History

2024-09-20 17:12:22 +02:00
{% extends "base.html" %}
{% block title %}Admin Dashboard{% endblock %}
{% block content %}
<h1>Admin Dashboard</h1>
<div class="card mb-4">
<div class="card-header">
Admin Toolbox
</div>
<div class="card-body">
<h5 class="card-title">Database Management</h5>
<form action="{{ url_for('reset_db') }}" method="POST" class="mb-3" onsubmit="return confirm('Are you sure you want to reset the database? This action cannot be undone.');">
<button type="submit" class="btn btn-danger">fucking nuke the db</button>
</form>
<a href="{{ url_for('backup_db') }}" class="btn btn-primary mb-3">bekáp the db</a>
<h5 class="card-title">File Management</h5>
<form action="{{ url_for('clear_uploads') }}" method="POST" class="mb-3" onsubmit="return confirm('Are you sure you want to clear all uploaded files? This action cannot be undone.');">
<button type="submit" class="btn btn-warning">Clear Upload Folder</button>
</form>
</div>
</div>
<h2>All Posts</h2>
{% for post in posts %}
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">{{ post.author.username if post.author else 'Anonymous' }}</h5>
<p class="card-text">{{ post.content }}</p>
<p class="card-text"><small class="text-muted">{{ post.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</small></p>
<form action="{{ url_for('delete_post', post_id=post.id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this post?');">
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
</form>
</div>
</div>
{% endfor %}
{% endblock %}