fix: correct login endpoint name, clean UTF-8 layout/login, and use blueprint endpoints in navbar
This commit is contained in:
@@ -1,112 +1,60 @@
|
||||
<a class="nav-link{% if request.path.startswith('/admin/users') %} active{% endif %}" href="{{ url_for('manage_users') }}">Пользователи</a>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ title or "Админка" }}</title>
|
||||
<title>{{ title or "Опросник" }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<style>
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
font-family: 'Inter', sans-serif;
|
||||
}
|
||||
.navbar {
|
||||
background-color: #e9f6ff !important;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 0 0 10px 10px;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
|
||||
}
|
||||
.navbar-brand {
|
||||
font-weight: 600;
|
||||
font-size: 1.3rem;
|
||||
color: #000 !important;
|
||||
}
|
||||
.btn {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.btn:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
.container {
|
||||
max-width: 960px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center" href="{{ url_for('choose_survey') }}">
|
||||
<img src="{{ url_for('static', filename='mont.png') }}" height="40" class="me-2">
|
||||
<span>Опросник</span>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarNav" aria-controls="navbarNav"
|
||||
aria-expanded="false" aria-label="Меню">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
{% if current_user.is_authenticated and current_user.is_admin %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path.startswith('/admin/users') %} active{% endif %}" href="{{ url_for('manage_users') }}">Пользователи</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path.startswith('/quiz') %} active{% endif %}" href="{{ url_for('choose_survey') }}">Опросы</a>
|
||||
</li>
|
||||
{% if current_user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path.startswith('/admin') %} active{% endif %}" href="{{ url_for('manage_surveys') }}">Админка</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path.startswith('/dashboard') %} active{% endif %}" href="{{ url_for('dashboard') }}">Отчёты</a>
|
||||
</li>
|
||||
<li class="nav-item d-flex align-items-center text-dark ms-3">
|
||||
<i class="bi bi-person-circle me-1"></i> {{ current_user.full_name or current_user.username }}
|
||||
{% if current_user.is_admin %}<span class="badge bg-danger ms-2">Админ</span>{% endif %}
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('logout') }}">Выйти</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if request.path.startswith('/login') %} active{% endif %}" href="{{ url_for('login') }}">Вход</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
<nav class="navbar navbar-expand-lg" style="background-color:#e9f6ff;">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center" href="{{ url_for('core.choose_survey') }}">
|
||||
<img src="{{ url_for('static', filename='mont.png') }}" height="40" class="me-2">
|
||||
<span>MONT Опросник</span>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Переключить навигацию">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/quiz') %} active{% endif %}" href="{{ url_for('core.choose_survey') }}">Опросы</a></li>
|
||||
{% if current_user.is_authenticated %}
|
||||
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/dashboard') %} active{% endif %}" href="{{ url_for('core.dashboard') }}">Отчёты</a></li>
|
||||
{% if current_user.is_admin %}
|
||||
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/admin/users') %} active{% endif %}" href="{{ url_for('admin_users.manage_users') }}">Пользователи</a></li>
|
||||
{% endif %}
|
||||
<li class="nav-item d-flex align-items-center text-dark ms-3">
|
||||
<i class="bi bi-person-circle me-1"></i> {{ current_user.full_name or current_user.username }}
|
||||
{% if current_user.is_admin %}<span class="badge bg-danger ms-2">Админ</span>{% endif %}
|
||||
</li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('auth.logout') }}">Выйти</a></li>
|
||||
{% else %}
|
||||
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/login') %} active{% endif %}" href="{{ url_for('auth.login') }}">Вход</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-5">
|
||||
{% block content %}{% endblock %}
|
||||
{% block content %}{% endblock %}
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="mt-3">
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</main>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
function showLoading(form) {
|
||||
const button = form.querySelector('button[type="submit"]');
|
||||
button.disabled = true;
|
||||
button.innerHTML = `<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>Отправка...`;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const form = document.querySelector('form');
|
||||
const submitBtn = document.getElementById('submitBtn');
|
||||
|
||||
if (form && submitBtn) {
|
||||
form.addEventListener('submit', function () {
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.innerHTML = '⏳ Отправка...';
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user