Files
vesti/web/templates/base.html
T
2026-10-28 13:13:05 +00:00

50 lines
2.6 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/css/style.css" rel="stylesheet">
</head>
<body class="bg-neutral-100 text-neutral-900" data-page="{% block page %}x{% endblock %}">
<header class="sticky top-0 z-40 bg-neutral-900 text-neutral-100 shadow-sm">
<div class="flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2">
<a class="font-semibold no-underline text-white whitespace-nowrap" href="/candidates">📰 VESTI</a>
<nav class="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
<a class="no-underline text-neutral-300 hover:text-white" href="/candidates">Кандидаты</a>
<a class="no-underline text-neutral-300 hover:text-white" href="/selected">⭐ Отобранные</a>
<a class="no-underline text-neutral-300 hover:text-white" href="/published">Опубликовано</a>
<a class="no-underline text-neutral-300 hover:text-white" href="/metrics">Метрики</a>
<a class="no-underline text-neutral-300 hover:text-white" href="/crawlers">Краулеры</a>
<a class="no-underline text-neutral-300 hover:text-white" href="/sources">Источники</a>
<a class="no-underline text-red-400 hover:text-red-300" href="/logout">Выйти</a>
</nav>
</div>
</header>
<main class="px-4 py-3">
{% block content %}{% endblock %}
</main>
{% block scripts %}{% endblock %}
<script>
// Общий хелпер 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>