Files
sport-prog-club/app/templates/materials.html
T
Кирилл ЯценкоandClaude Opus 5 d4bbe9e021 Все страницы и сообщения помечены к переводу
Обёрнуты `_()` строки всех шаблонов и сообщения, которые видит человек:
флеши, ошибки, подписи таблиц, выгрузка в CSV. Словари en/fr пока пустые
на эти строки — значит, страница остаётся русской, пока перевод не написан.

Константы модулей — месяцы, разделы, периоды табло — помечены `N_()`:
они собираются при импорте, когда язык ещё неизвестен, а переводятся при
выводе. Сборщик словаря теперь разбирает питон деревом, поэтому склеенные
из нескольких кусков строки не теряются.

Фильтр `plural` стал знать про язык: формы слова приходят одной строкой
(«день|дня|дней», «day|days»), правило выбирается по текущему языку.
«5 минут назад» собирается целой фразой — во французском «назад» стоит
впереди.

Название курса переехало в COURSE_TITLE: в открытом исходнике чужому вузу
ни к чему «Алгоритмы и структуры данных».

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 20:20:19 +05:00

80 lines
3.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% from "_ui.html" import empty %}
{% block title %}{{ _("Материалы") }} — {{ settings.app_name }}{% endblock %}
{% block content %}
<div class="page-head">
<div>
<p class="eyebrow">{{ _("библиотека") }}</p>
<h1>{{ _("Материалы") }}</h1>
<p class="sub">{{ _("Ноутбуки с семинаров, конспекты и разборы.") }}</p>
</div>
</div>
{% if teacher_view %}
<details class="formula" style="margin-bottom:18px" {% if not items %}open{% endif %}>
<summary>{{ icon("plus") }} {{ _("Опубликовать материал") }}</summary>
<form method="post" action="/materials" enctype="multipart/form-data" style="margin-top:12px">
<div class="grid two">
<div class="field">
<label for="file">{{ _("Файл") }}</label>
<input type="file" id="file" name="file" required>
</div>
<div class="field">
<label for="title">{{ _("Название (пусто — имя файла)") }}</label>
<input type="text" id="title" name="title" placeholder="{{ _("Семинар 3. Сортировки") }}">
</div>
<div class="field">
<label for="group_id">{{ _("Кому") }}</label>
<select id="group_id" name="group_id">
<option value="">{{ _("Всем") }}</option>
{% for group in groups %}<option value="{{ group.id }}">{{ group.title }}</option>{% endfor %}
</select>
</div>
<div class="field">
<label for="description">{{ _("Описание (необязательно)") }}</label>
<input type="text" id="description" name="description" placeholder="{{ _("Разбор задач 1–4") }}">
</div>
</div>
<p class="small muted">{{ _("До %(mb)s МБ.") % {"mb": max_mb} }} {{ _("Форматы:") }} {{ extensions }}.</p>
<button type="submit">{{ icon("send") }} {{ _("Опубликовать") }}</button>
</form>
</details>
{% endif %}
{% if items %}
<div class="grid two">
{% for item in items %}
<div class="card material">
<div class="row between" style="align-items:flex-start; gap:10px">
<h3 style="margin:0">{{ icon("book") }} {{ item.title }}</h3>
<span class="badge">{{ item.group.title if item.group else _("всем") }}</span>
</div>
{% if item.description %}<p class="small" style="margin:8px 0 0">{{ item.description }}</p>{% endif %}
<p class="small muted" style="margin:8px 0 0">
{{ item.filename }} · {{ item.size_label }} · {{ item.published_at | ago }}
</p>
<div class="row" style="margin-top:12px; gap:8px">
{% if item.can_preview %}
<a class="btn small" href="/materials/{{ item.id }}/view">{{ icon("book") }} {{ _("Смотреть") }}</a>
<a class="btn ghost small" href="/materials/{{ item.id }}/download">{{ icon("download") }} {{ _("Скачать") }}</a>
{% else %}
<a class="btn small" href="/materials/{{ item.id }}/download">{{ icon("download") }} {{ _("Скачать") }}</a>
{% endif %}
{% if teacher_view %}
<form method="post" action="/materials/{{ item.id }}/delete"
onsubmit="return confirm('{{ _("Удалить") }} «{{ item.title }}»?')">
<button class="danger small" type="submit">{{ icon("trash") }}</button>
</form>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="card">
{{ empty("book", _("Материалов пока нет.") if not teacher_view
else _("Материалов пока нет — выложи первый в форме выше.")) }}
</div>
{% endif %}
{% endblock %}