248a0eaa8a
- 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
69 lines
3.2 KiB
HTML
69 lines
3.2 KiB
HTML
<!doctype html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>VESTI — {% block title %}Управление{% endblock %}</title>
|
|
<link href="/static/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
body { padding-top: 4.5rem; background: #f5f6fa; }
|
|
.card { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
|
|
.post-text { white-space: pre-wrap; font-size: .9rem; }
|
|
/* список кандидатов: выбранный пост — светло-голубая заливка карточки */
|
|
.list-group-item.active-row { background-color: #dcecfc; }
|
|
.list-group-item.active-row:hover { background-color: #d0e4f8; }
|
|
[x-cloak] { display: none !important; }
|
|
</style>
|
|
</head>
|
|
<body data-page="{% block page %}x{% endblock %}">
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="/candidates">📰 VESTI</a>
|
|
<div class="navbar-nav">
|
|
<a class="nav-link" href="/candidates">Кандидаты</a>
|
|
<a class="nav-link" href="/selected">⭐ Отобранные</a>
|
|
<a class="nav-link" href="/published">Опубликовано</a>
|
|
<a class="nav-link" href="/metrics">Метрики</a>
|
|
<a class="nav-link" href="/crawlers">Краулеры</a>
|
|
<a class="nav-link" href="/sources">Источники</a>
|
|
<a class="nav-link text-danger" href="/logout">Выйти</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div class="container-fluid mt-2 px-3">
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
{% block scripts %}{% endblock %}
|
|
<script>
|
|
// Табы «Оригинал/Перевод» — клиентское состояние (Alpine). Стартовая вкладка: перевод, если есть кнопка «Перевод».
|
|
function tabState() {
|
|
return {
|
|
tab: 'orig',
|
|
init() {
|
|
var btn = this.$el.querySelector('button:nth-child(2)');
|
|
if (btn) this.tab = 'tr';
|
|
// при отсутствии перевода кнопка «Перевод» не рендерится — остаётся 'orig'
|
|
}
|
|
};
|
|
}
|
|
// Общий хелпер bulk-выбора (Alpine): отметки живут в sessionStorage, переживают перезагрузки и htmx-подмены списка.
|
|
function bulkSel() {
|
|
return {
|
|
ids: new Set(),
|
|
KEY: '',
|
|
init() {
|
|
this.KEY = 'vesti_bulk_' + (document.body.dataset.page || 'x');
|
|
try { this.ids = new Set(JSON.parse(sessionStorage.getItem(this.KEY) || '[]')); } catch(e) {}
|
|
// серверно-отмеченные (checked атрибут с сервера) — гарантированно в наборе
|
|
document.querySelectorAll('#bulk-form input[name="ids"]:checked').forEach(b => this.ids.add(b.value));
|
|
},
|
|
toggle(v) { this.ids.has(v) ? this.ids.delete(v) : this.ids.add(v); this.save(); },
|
|
save() { try { sessionStorage.setItem(this.KEY, JSON.stringify(Array.from(this.ids))); } catch(e) {} },
|
|
clear() { this.ids.clear(); this.save(); } // после submit
|
|
};
|
|
}
|
|
</script>
|
|
<script src="/static/htmx.min.js"></script>
|
|
<script src="/static/alpine.min.js" defer></script>
|
|
</body>
|
|
</html> |