Files
Evection/templates/core/_sidebar.html
T
ksmithandClaude Sonnet 5 cfa64b5485 Rebuild the reader UI to match FreshRSS's two-column layout
The previous UI was plain unstyled lists. Rebuilt around what FreshRSS
actually looks like (per reference screenshots): a persistent left sidebar
(folders/feeds with unread counts, favourites, tags) and a single main
column with a date-grouped article list, where clicking a title expands
the full article inline in place rather than navigating to a separate page.

- apps/core/context_processors.py: feeds the sidebar's folder/feed tree,
  tags, and starred count to every authenticated page in one shared query
  set, so base.html can render it without each view wiring it up.
- apps/reader/views.py: date-grouped stream (itertools.groupby over the
  already-ordered queryset), ?feed=/?folder= scoping alongside the existing
  ?tag=, a bulk mark-all-read endpoint (bulk_create/update, not one
  UserArticleState per article), and article_inline — the htmx endpoint
  behind the inline expand, sharing its mark-read logic with the full
  article_detail view via _load_article_and_mark_read.
- templates/reader/_article_inline.html returns the article content plus
  an out-of-band swap of _article_actions.html, so the row's read/star
  icons update immediately when an article is expanded and marked read.
- static/js/stream.js: the accordion toggle (one article open at a time),
  calling htmx.ajax() directly rather than hx-* attributes so a second
  click on an already-open row can collapse it without re-fetching.
- static/css/base.css: full FreshRSS-like dark theme (with a light
  variant under prefers-color-scheme) replacing the previous unstyled
  pass — sidebar, topbar search, row/icon states, inline-expand styling.

Verified end to end against a running dev server: folder/feed/tag scoping,
mark-all-read, the inline-expand mark-read side effect and its icon
update, and — against config.settings.prod specifically — that no inline
<script> crept back in anywhere (would silently break under the CSP added
in the previous commit) and the CSP header is still present on every page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-30 21:11:17 -06:00

89 lines
3.6 KiB
HTML

<nav class="sidebar" aria-label="Feeds and folders">
<div class="sidebar-brand">
<a href="{% url 'reader:stream' %}">Evection</a>
</div>
<a href="{% url 'feeds:subscription_list' %}" class="sidebar-manage-btn">Subscription management</a>
<ul class="sidebar-top-nav">
<li>
<a href="{% url 'reader:stream' %}?filter=all"
class="{% if not request.GET.tag and not request.GET.feed and not request.GET.folder and request.GET.filter == 'all' %}active{% endif %}">
All articles
</a>
</li>
<li>
<a href="{% url 'reader:stream' %}?filter=starred"
class="{% if request.GET.filter == 'starred' %}active{% endif %}">
Favourites{% if sidebar_starred_count %} ({{ sidebar_starred_count }}){% endif %}
</a>
</li>
<li>
<a href="{% url 'reader:stream' %}?filter=saved"
class="{% if request.GET.filter == 'saved' %}active{% endif %}">
Saved for later
</a>
</li>
</ul>
{% if sidebar_tags %}
<details class="sidebar-section" open>
<summary>Tags</summary>
<ul class="sidebar-item-list">
{% for tag in sidebar_tags %}
<li>
<a href="{% url 'reader:stream' %}?filter=all&tag={{ tag.pk }}"
class="{% if request.GET.tag == tag.pk|stringformat:'s' %}active{% endif %}">{{ tag.name }}</a>
</li>
{% endfor %}
</ul>
</details>
{% endif %}
{% for entry in sidebar_folders %}
<details class="sidebar-section" open>
<summary>
<a href="{% url 'reader:stream' %}?filter=all&folder={{ entry.folder.pk }}"
class="sidebar-folder-link{% if request.GET.folder == entry.folder.pk|stringformat:'s' %} active{% endif %}">{{ entry.folder.name }}</a>
</summary>
<ul class="sidebar-item-list">
{% for subscription in entry.subscriptions %}
<li>
<a href="{% url 'reader:stream' %}?filter=all&feed={{ subscription.feed_id }}"
class="sidebar-feed-link{% if request.GET.feed == subscription.feed_id|stringformat:'s' %} active{% endif %}">
{% if subscription.feed.favicon_url %}<img src="{{ subscription.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
<span>{{ subscription.display_title }}</span>
</a>
{% if subscription.unread_count %}<span class="unread-count">{{ subscription.unread_count }}</span>{% endif %}
</li>
{% endfor %}
</ul>
</details>
{% endfor %}
{% if sidebar_unfoldered %}
<details class="sidebar-section" open>
<summary>Uncategorized</summary>
<ul class="sidebar-item-list">
{% for subscription in sidebar_unfoldered %}
<li>
<a href="{% url 'reader:stream' %}?filter=all&feed={{ subscription.feed_id }}"
class="sidebar-feed-link{% if request.GET.feed == subscription.feed_id|stringformat:'s' %} active{% endif %}">
{% if subscription.feed.favicon_url %}<img src="{{ subscription.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
<span>{{ subscription.display_title }}</span>
</a>
{% if subscription.unread_count %}<span class="unread-count">{{ subscription.unread_count }}</span>{% endif %}
</li>
{% endfor %}
</ul>
</details>
{% endif %}
<ul class="sidebar-top-nav sidebar-footer-nav">
<li><a href="{% url 'articles:tag_list' %}">Manage tags</a></li>
<li><a href="{% url 'rules:rule_list' %}">Rules</a></li>
{% if request.user.is_staff %}<li><a href="{% url 'core:dashboard' %}">Dashboard</a></li>{% endif %}
<li><a href="{% url 'accounts:logout' %}">Log out</a></li>
</ul>
</nav>