Features added: - Admin authentication system with is_admin field - Complete admin dashboard with user statistics - User management (create, edit, delete, toggle admin) - Protected admin routes with @admin_required decorator - Security features (prevent self-deletion, last admin protection) - Responsive admin UI with Bootstrap integration - Database migration script for admin field - Admin navigation link for authorized users Technical improvements: - Enhanced 3-column dashboard layout (tables | editor | saved queries) - Removed plus button and made right sidebar more compact - Admin user (admin/admin123) automatically created with admin privileges - Full CRUD operations for user management - Flash messages for user feedback - Form validation and error handling
69 lines
2.8 KiB
HTML
69 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% block title %}Query Builder{% endblock %}</title>
|
|
<link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
|
<!-- Bootstrap CSS (lokal gehostet) -->
|
|
<link href="{{ url_for('static', filename='css/vendor/bootstrap.min.css') }}" rel="stylesheet">
|
|
|
|
<!-- Font Awesome Icons (lokal gehostet) -->
|
|
<link href="{{ url_for('static', filename='css/vendor/all-local.min.css') }}" rel="stylesheet">
|
|
|
|
<!-- Custom Styles (Fallback für Bootstrap + eigene Styles) -->
|
|
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="{{ url_for('main.dashboard') }}">
|
|
<i class="fas fa-database"></i> Query Builder
|
|
</a>
|
|
|
|
{% if current_user.is_authenticated %}
|
|
<div class="navbar-nav ms-auto">
|
|
{% if current_user.is_admin %}
|
|
<a class="nav-link me-3" href="{{ url_for('admin.admin_dashboard') }}">
|
|
<i class="fas fa-users-cog"></i> Admin
|
|
</a>
|
|
{% endif %}
|
|
<span class="navbar-text me-3">
|
|
<i class="fas fa-user"></i> {{ current_user.username }}
|
|
{% if current_user.is_admin %}
|
|
<span class="badge bg-danger ms-1">Admin</span>
|
|
{% endif %}
|
|
</span>
|
|
<a class="nav-link" href="{{ url_for('auth.logout') }}">
|
|
<i class="fas fa-sign-out-alt"></i> Abmelden
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container-fluid">
|
|
{% with messages = get_flashed_messages() %}
|
|
{% if messages %}
|
|
<div class="row mt-3">
|
|
<div class="col-12">
|
|
{% for message in messages %}
|
|
<div class="alert alert-info alert-dismissible fade show" role="alert">
|
|
{{ message }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
{% block content %}{% endblock %}
|
|
</main>
|
|
|
|
<!-- Bootstrap JS (lokal gehostet) -->
|
|
<script src="{{ url_for('static', filename='js/vendor/bootstrap.bundle.min.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
|
|
{% block scripts %}{% endblock %}
|
|
</body>
|
|
</html> |