Files
lokses 0057f367a2 core: кастомные страницы ошибок 404/403/500/503 + режим техработ
Единый стиль портала (логотип, тема, кнопки) через error_base.html:
- 404 — страница не найдена
- 403 — доступ запрещён (+ ссылка на IT-поддержку)
- 500 — внутренняя ошибка (автономна: без request/context-процессоров)
- 503 — технические работы

MaintenanceModeMiddleware: при MAINTENANCE_MODE=True отдаёт 503 всем, кроме
суперпользователей и путей входа/админки/статики (чтобы админ мог войти и
выключить режим). По умолчанию выключен — поведение не меняется.

- tests: рендер всех шаблонов, кастомный 404, режим техработ вкл/выкл/супер

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-21 23:54:34 +03:00

50 lines
3.0 KiB
HTML

{% load static %}
<!DOCTYPE html>
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block page_title %}Ошибка{% endblock %} — АКС</title>
<link rel="stylesheet" href="{% static 'assets/css/main.css' %}">
</head>
<body style="background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-sidebar-accent) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; font-family: var(--font-sans);">
<button onclick="toggleTheme()" title="Тема" style="position: fixed; top: 1rem; right: 1rem; background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.5rem; color: var(--color-foreground); cursor: pointer;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/>
</svg>
</button>
<div style="width: 100%; max-width: 30rem; background: var(--color-card); border-radius: 0.75rem; border: 1px solid var(--color-border); box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); overflow: hidden;">
<div style="padding: 2.5rem 2rem; text-align: center;">
<div style="width: 3rem; height: 3rem; margin: 0 auto 1rem;">
<img src="{% static 'assets/img/logosm.svg' %}" alt="АКС" style="width: 100%; height: 100%; object-fit: contain;">
</div>
<div style="font-size: 4rem; font-weight: 800; line-height: 1; color: {% block accent_color %}var(--color-muted-foreground){% endblock %}; letter-spacing: -0.02em;">{% block code %}500{% endblock %}</div>
<h1 style="font-size: 1.25rem; font-weight: 700; color: var(--color-foreground); margin: 1rem 0 0.5rem;">{% block heading %}Что-то пошло не так{% endblock %}</h1>
<p style="font-size: 0.9375rem; color: var(--color-muted-foreground); line-height: 1.6; margin-bottom: 1.75rem;">{% block message %}Произошла ошибка. Попробуйте позже.{% endblock %}</p>
<div style="display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap;">
{% block actions %}
<a href="/dashboard/" class="btn btn-primary" style="text-decoration: none; padding: 0.6rem 1.25rem;">На главную</a>
<button onclick="history.back()" class="btn btn-secondary" style="border: 1px solid var(--color-border); padding: 0.6rem 1.25rem;">Назад</button>
{% endblock %}
</div>
</div>
</div>
<script>
function toggleTheme() {
document.body.classList.toggle('dark');
localStorage.setItem('theme', document.body.classList.contains('dark') ? 'dark' : 'light');
}
if (localStorage.getItem('theme') === 'dark') {
document.body.classList.add('dark');
}
</script>
</body>
</html>