chore(ui): remove 'MONT Опросник' label near logo in layout
This commit is contained in:
14
main.py
14
main.py
@@ -9,6 +9,7 @@ from email.mime.text import MIMEText
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -76,6 +77,19 @@ if os.environ.get('SEED_TEST_USERS_DISABLED') != '1':
|
|||||||
ensure_test_users()
|
ensure_test_users()
|
||||||
|
|
||||||
|
|
||||||
|
# Admin-only decorator must be defined before routes that use it
|
||||||
|
def admin_required(f):
|
||||||
|
@wraps(f)
|
||||||
|
def decorated_function(*args, **kwargs):
|
||||||
|
if not current_user.is_authenticated:
|
||||||
|
return redirect(url_for('login'))
|
||||||
|
if not getattr(current_user, 'is_admin', False):
|
||||||
|
flash('Недостаточно прав', 'danger')
|
||||||
|
return redirect(url_for('dashboard'))
|
||||||
|
return f(*args, **kwargs)
|
||||||
|
return decorated_function
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin/users', methods=['GET', 'POST'])
|
@app.route('/admin/users', methods=['GET', 'POST'])
|
||||||
@admin_required
|
@admin_required
|
||||||
def manage_users():
|
def manage_users():
|
||||||
|
|||||||
@@ -1,59 +1,57 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{{ title or "Опросник" }}</title>
|
<title>{{ title or "Опросник" }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<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 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 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 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') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg" style="background-color:#e9f6ff;">
|
||||||
<nav class="navbar navbar-expand-lg" style="background-color:#e9f6ff;">
|
<div class="container">
|
||||||
<div class="container">
|
<a class="navbar-brand d-flex align-items-center" href="{{ url_for('choose_survey') }}">
|
||||||
<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">
|
||||||
<img src="{{ url_for('static', filename='mont.png') }}" height="40" class="me-2">
|
</a>
|
||||||
<span>MONT Опросник</span>
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Переключить навигацию">
|
||||||
</a>
|
<span class="navbar-toggler-icon"></span>
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Переключить навигацию">
|
</button>
|
||||||
<span class="navbar-toggler-icon"></span>
|
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
|
||||||
</button>
|
<ul class="navbar-nav">
|
||||||
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
|
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/quiz') %} active{% endif %}" href="{{ url_for('choose_survey') }}">Опросы</a></li>
|
||||||
<ul class="navbar-nav">
|
{% if current_user.is_authenticated %}
|
||||||
<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('/dashboard') %} active{% endif %}" href="{{ url_for('dashboard') }}">Отчёты</a></li>
|
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/dashboard') %} active{% endif %}" href="{{ url_for('dashboard') }}">Отчёты</a></li>
|
||||||
{% if current_user.is_admin %}
|
{% if 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>
|
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/admin/users') %} active{% endif %}" href="{{ url_for('manage_users') }}">Пользователи</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="nav-item d-flex align-items-center text-dark ms-3">
|
<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 }}
|
<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 %}
|
{% if current_user.is_admin %}<span class="badge bg-danger ms-2">Админ</span>{% endif %}
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('logout') }}">Выйти</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('logout') }}">Выйти</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/login') %} active{% endif %}" href="{{ url_for('login') }}">Вход</a></li>
|
<li class="nav-item"><a class="nav-link{% if request.path.startswith('/login') %} active{% endif %}" href="{{ url_for('login') }}">Вход</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<main class="container my-5">
|
|
||||||
{% 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>
|
</div>
|
||||||
{% endif %}
|
</div>
|
||||||
{% endwith %}
|
</nav>
|
||||||
</main>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
<main class="container my-5">
|
||||||
|
{% 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>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user