Files
vesti/web/templates/candidates.html
T
kpa39l 248a0eaa8a frontend: htmx+alpine на модерации (candidates/selected)
- htmx 2.0.4 + alpine 3.17.4 локально в web/static/ (без CDN, zero-build)
- HX-действия (approve/reject/select/translate/bulk) -> 204 + HX-Trigger refresh-list/refresh-detail; без JS — обычный POST (302)
- левая панель -> _candidates_list.html/_selected_list.html (id=list-panel, hx-get+outerHTML)
- правая панель кандидатов -> _detail_candidates.html (id=detail-panel, HX-Target detail-panel, refresh-detail)
- фильтры hx-get с debounce; Alpine: табы (tabState/inline), bulkSel() (Set+sessionStorage), [x-cloak]
- vanilla JS scripts-блоки удалены из candidates/selected; подтверждение — inline confirm
- openspec change frontend-htmx-alpine (proposal/design/tasks/spec/ADR-0001), валиден
- Bootstrap остаётся временно: следующий change — Tailwind+Frutjam
2026-10-13 07:17:01 +00:00

62 lines
2.5 KiB
HTML

{% extends "base.html" %}
{% block page %}candidates{% endblock %}
{% block title %}Кандидаты{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-2">
<h4 class="mb-0">Кандидаты</h4>
<div class="text-muted small">
{% if selected %}
#{{ selected.id }} · {{ selected.source_name or selected.tg_channel or '?' }}
{% endif %}
</div>
</div>
{% if error %}
<div class="alert alert-danger py-2">❌ {{ error }}</div>
{% endif %}
<form class="row g-2 mb-2" method="get" action="/candidates"
hx-get="/candidates" hx-target="#list-panel" hx-swap="outerHTML"
hx-trigger="submit, change delay:600ms from:select, keyup delay:500ms from:input[name='q']">
<div class="col-auto">
<input type="text" name="q" value="{{ q }}" class="form-control form-control-sm" placeholder="поиск…">
</div>
<div class="col-auto">
<select name="status" class="form-select form-select-sm">
{% for val, label in [('', 'Все'), ('new', '💎 Новые'), ('rejected', '🗑 Отклонённые'), ('published', '✅ Опубл.')] %}
<option value="{{ val }}" {% if status == val %}selected{% endif %}>{{ label }}{% if counts.get(val) %} ({{ counts[val] }}){% endif %}</option>
{% endfor %}
</select>
</div>
<div class="col-auto">
<select name="direction" class="form-select form-select-sm">
<option value="">Все направления</option>
{% for d in directions %}
<option value="{{ d }}" {% if direction == d %}selected{% endif %}>{{ d }}</option>
{% endfor %}
</select>
</div>
<div class="col-auto">
<select name="own" class="form-select form-select-sm">
<option value="">Все посты</option>
<option value="1" {% if own == '1' %}selected{% endif %}>⭐ Свои</option>
<option value="0" {% if own == '0' %}selected{% endif %}>Внешние</option>
</select>
</div>
<div class="col-auto">
<button class="btn btn-sm btn-outline-secondary" type="submit">Применить</button>
</div>
</form>
{% set selected_qs = '&selected=' ~ selected.id if selected else '' %}
<div class="row g-0">
<!-- ЛЕВАЯ ПАНЕЛЬ: список + группировка + массовые операции -->
<div class="col-md-4">
{% include "_candidates_list.html" %}
</div>
<!-- ПРАВАЯ ПАНЕЛЬ: детали выбранного (partial самодостаточен: col-md-8 + id + hx-атрибуты) -->
{% include "_detail_candidates.html" %}
</div>
{% endblock %}