init commit
This commit is contained in:
192
templates/ui/cabinet.html
Normal file
192
templates/ui/cabinet.html
Normal file
@@ -0,0 +1,192 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Кабинет</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link href="{% static 'style.css' %}" rel="stylesheet">
|
||||
<style>
|
||||
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", sans-serif; margin:0; background:#f7f7fb; color:#111; }
|
||||
.topbar { display:flex; gap:16px; align-items:center; padding:14px 18px; background:#111827; color:#fff; }
|
||||
.topbar a { color:#cfe3ff; text-decoration:none; }
|
||||
.container { max-width:1100px; margin:24px auto; padding:0 16px; }
|
||||
.heading { display:flex; align-items:flex-end; gap:12px; margin:8px 0 18px; }
|
||||
.heading h1 { margin:0; font-size:24px; }
|
||||
.muted { color:#6b7280; font-size:14px; }
|
||||
.card { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:18px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
|
||||
.grid { display:grid; gap:16px; }
|
||||
.grid-2 { grid-template-columns: 1fr 1fr; }
|
||||
.form { display:grid; gap:14px; }
|
||||
.form label { font-weight:600; font-size:14px; }
|
||||
.form input[type="text"], .form select, .form textarea {
|
||||
width:100%; border:1px solid #d1d5db; border-radius:8px; padding:10px 12px; font:inherit; background:#fff;
|
||||
}
|
||||
.form small { color:#6b7280; }
|
||||
.btnrow { display:flex; gap:10px; margin-top:8px; }
|
||||
.btn { display:inline-block; padding:10px 14px; border-radius:10px; border:1px solid transparent; font-weight:600; cursor:pointer; }
|
||||
.btn-primary { background:#2563eb; color:#fff; }
|
||||
.btn-outline { background:#fff; color:#111; border-color:#d1d5db; }
|
||||
.messages { list-style:none; padding:0; margin:0 0 16px; }
|
||||
.messages li { padding:10px 12px; margin-bottom:8px; border-radius:10px; }
|
||||
.messages li.success { background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }
|
||||
.messages li.error { background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
|
||||
.messages li.info { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }
|
||||
dl { display:grid; grid-template-columns: 200px 1fr; gap:8px 14px; margin: 0; }
|
||||
dt { font-weight:600; color:#374151; }
|
||||
dd { margin:0; color:#111827; }
|
||||
.pill { display:inline-block; padding:4px 10px; border-radius:999px; background:#eef2ff; color:#3730a3; font-size:12px; margin:2px 6px 2px 0; }
|
||||
details summary { cursor:pointer; }
|
||||
code, pre { background:#111827; color:#e5e7eb; padding:10px 12px; border-radius:10px; display:block; overflow:auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="topbar">
|
||||
<div style="flex:1 1 auto;">
|
||||
{% with header_name=header_name|default:request.session.user_full_name|default:request.session.user_email %}
|
||||
Здравствуйте, <strong>{{ header_name }}</strong>!
|
||||
{% endwith %}
|
||||
</div>
|
||||
<nav style="display:flex; gap:14px;">
|
||||
<a href="{% url 'index' %}">Главная</a>
|
||||
<a href="{% url 'cabinet' %}">Кабинет</a>
|
||||
<a href="{% url 'profiles' %}">Каталог</a>
|
||||
<a href="{% url 'logout' %}">Выход</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li class="{{ message.tags }}">{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<div class="heading">
|
||||
<h1>Кабинет</h1>
|
||||
{% if has_profile %}
|
||||
<span class="muted">профиль создан</span>
|
||||
{% else %}
|
||||
<span class="muted">профиль ещё не создан</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Две колонки: Аккаунт + Профиль -->
|
||||
<div class="grid grid-2">
|
||||
<!-- ======= ДАННЫЕ АККАУНТА ======= -->
|
||||
<section class="card">
|
||||
<h2 class="muted" style="margin-top:0;">Данные аккаунта</h2>
|
||||
<dl>
|
||||
<dt>Имя</dt>
|
||||
<dd>{{ request.session.user_full_name|default:"—" }}</dd>
|
||||
|
||||
<dt>Email</dt>
|
||||
<dd>{{ request.session.user_email|default:"—" }}</dd>
|
||||
|
||||
<dt>Роль</dt>
|
||||
<dd><span class="pill">{{ request.session.user_role|default:"—" }}</span></dd>
|
||||
|
||||
<dt>ID пользователя</dt>
|
||||
<dd><code>{{ request.session.user_id|default:"—" }}</code></dd>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<!-- ======= ДАННЫЕ ПРОФИЛЯ ======= -->
|
||||
<section class="card">
|
||||
<h2 class="muted" style="margin-top:0;">Данные профиля</h2>
|
||||
|
||||
{% if has_profile and profile %}
|
||||
<dl>
|
||||
<dt>Пол</dt>
|
||||
<dd>{{ profile.gender|default:"—" }}</dd>
|
||||
|
||||
<dt>Город</dt>
|
||||
<dd>{{ profile.city|default:"—" }}</dd>
|
||||
|
||||
<dt>Языки</dt>
|
||||
<dd>
|
||||
{% if profile.languages %}
|
||||
{% for lang in profile.languages %}<span class="pill">{{ lang }}</span>{% endfor %}
|
||||
{% else %} — {% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>Интересы</dt>
|
||||
<dd>
|
||||
{% if profile.interests %}
|
||||
{% for it in profile.interests %}<span class="pill">{{ it }}</span>{% endfor %}
|
||||
{% else %} — {% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>ID профиля</dt>
|
||||
<dd><code>{{ profile.id }}</code></dd>
|
||||
|
||||
<dt>ID пользователя (в профиле)</dt>
|
||||
<dd><code>{{ profile.user_id }}</code></dd>
|
||||
</dl>
|
||||
|
||||
<details style="margin-top:12px;">
|
||||
<summary class="muted">Показать сырой JSON профиля</summary>
|
||||
<pre>{{ profile|safe }}</pre>
|
||||
</details>
|
||||
|
||||
{% else %}
|
||||
<p class="muted">Профиль ещё не создан. Заполните форму ниже.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{% if not has_profile or not profile %}
|
||||
<!-- ======= ФОРМА СОЗДАНИЯ ПРОФИЛЯ ======= -->
|
||||
<section class="card" style="margin-top:16px;" aria-labelledby="section-create">
|
||||
<h2 id="section-create" class="muted" style="margin-top:0;">Создать профиль</h2>
|
||||
|
||||
<form class="form" method="post" action="{% url 'cabinet' %}">
|
||||
{% csrf_token %}
|
||||
<div class="grid grid-2">
|
||||
<div>
|
||||
<label for="gender">Пол</label>
|
||||
<select id="gender" name="gender" required>
|
||||
<option value="">— выберите —</option>
|
||||
<option value="male" {% if request.POST.gender == "male" %}selected{% endif %}>Мужской</option>
|
||||
<option value="female" {% if request.POST.gender == "female" %}selected{% endif %}>Женский</option>
|
||||
<option value="other" {% if request.POST.gender == "other" %}selected{% endif %}>Другое</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="city">Город</label>
|
||||
<input id="city" name="city" type="text" required
|
||||
value="{{ request.POST.city|default_if_none:'' }}" placeholder="Москва">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="languages">Языки</label>
|
||||
<input id="languages" name="languages" type="text"
|
||||
value="{{ request.POST.languages|default_if_none:'' }}" placeholder="ru,en">
|
||||
<small>Несколько — через запятую: <code>ru,en</code></small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="interests">Интересы</label>
|
||||
<input id="interests" name="interests" type="text"
|
||||
value="{{ request.POST.interests|default_if_none:'' }}" placeholder="music,travel">
|
||||
<small>Несколько — через запятую: <code>music,travel</code></small>
|
||||
</div>
|
||||
|
||||
<div class="btnrow">
|
||||
<button class="btn btn-primary" type="submit">Создать профиль</button>
|
||||
<a class="btn btn-outline" href="{% url 'cabinet' %}">Сбросить</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user