morozovka-portal/app/templates/feed.html

76 lines
3.9 KiB
HTML
Raw Permalink 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" %}
{% block title %}Лента — Morozovka Portal{% endblock %}
{% block main_class %}container container-narrow{% endblock %}
{% block content %}
<div class="page-header">
<div>
<h1 class="page-title">Лента</h1>
<p class="page-subtitle">Все новости из мастер-классов и проектов в одном потоке</p>
</div>
</div>
<div class="filters">
<span class="filter-label">Источник:</span>
<a href="?source=all{% if q %}&q={{ q }}{% endif %}" class="filter-chip {% if current_source == 'all' %}active{% endif %}">Все</a>
<a href="?source=workshops{% if q %}&q={{ q }}{% endif %}" class="filter-chip {% if current_source == 'workshops' %}active{% endif %}">🎓 Мастер-классы</a>
<a href="?source=projects{% if q %}&q={{ q }}{% endif %}" class="filter-chip {% if current_source == 'projects' %}active{% endif %}">🗂 Проекты</a>
<form method="GET" class="search-form" style="margin-left: auto;">
{% if current_source != 'all' %}<input type="hidden" name="source" value="{{ current_source }}">{% endif %}
<input type="text" name="q" class="search-input" placeholder="Поиск по постам..." value="{{ q }}">
<button type="submit" class="search-btn">🔍</button>
{% if q %}<a href="?source={{ current_source }}" class="filter-chip filter-chip-clear">✕</a>{% endif %}
</form>
</div>
{% if items %}
<div class="muted" style="font-size:12px;margin-bottom:12px;">
Показано {{ items|length }}{% if total_count > items|length %} из {{ total_count }}{% endif %}
</div>
{% for item in items %}
<div class="post-card{% if item.is_pinned %} pinned{% endif %}">
<div class="post-head">
<div style="flex:1;min-width:0;">
<div class="post-title">
{% if item.is_pinned %}<span class="pin-mark">📌</span>{% endif %}
<span class="source-pill {{ item.kind }}">{{ item.kind_icon }} {{ item.kind_label }}</span>
{{ item.title }}
</div>
<div class="post-meta">
в <a href="{{ item.source_url }}">{{ item.source_title }}</a>
· {{ item.author_name }} <span class="dim">@{{ item.author_username }}</span>
· {{ item.created_at|msk_strftime('%d.%m.%Y %H:%M') }}
</div>
</div>
</div>
{% if item.body %}<div class="post-body">{{ item.body }}</div>{% endif %}
{% if item.attachments %}
<div class="post-attachments">
{% for fid in item.attachments %}
{% set f = files_map.get(fid) %}
{% if f %}
{% if f.original_name|is_image %}
<div class="post-image-wrap">
<a href="/files/preview/{{ f.id }}" target="_blank">
<img src="/files/preview/{{ f.id }}" alt="{{ f.original_name }}" loading="lazy">
</a>
<div class="post-image-name">{{ f.original_name }} · {{ (f.size_bytes/1024)|round(1) }} КБ</div>
</div>
{% else %}
<div class="post-attachment">{{ f.original_name|file_icon }} <a href="/files/download/{{ f.id }}">{{ f.original_name }}</a> <span class="dim">({{ (f.size_bytes/1024)|round(1) }} КБ)</span></div>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
{% else %}
<div class="empty-state">
<h3>{% if q %}Ничего не найдено{% else %}Пока нет постов{% endif %}</h3>
<p>{% if q %}Попробуйте другой запрос или <a href="?source={{ current_source }}">сбросьте поиск</a>.{% else %}Когда появятся новости в мастер-классах или проектах — они появятся здесь.{% endif %}</p>
</div>
{% endif %}
{% endblock %}