Private
Public Access
Closes gitea#24: the sidebar's per-feed unread counts were already computed by sidebar() (apps.core.context_processors); each tag group's total is now the sum of its own feeds' counts (a feed can carry more than one tag, so this reuses the same per-feed data rather than a second query) and renders next to the tag name like a feed's own count. Closes gitea#25: each sidebar <details> section (one per tag, plus "Untagged") now carries a stable data-sidebar-key, and static/js/sidebar-state.js remembers which ones are collapsed in localStorage — this isn't a SPA, so every click re-renders the sidebar server-side, and previously every section reset back to expanded on the next page load. Per-browser, same pattern as theme.js/theme-init.js, not synced across devices/accounts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
95 lines
4.0 KiB
HTML
95 lines
4.0 KiB
HTML
{% load static %}
|
|
<nav class="sidebar" aria-label="Feeds and tags">
|
|
<div class="sidebar-brand">
|
|
<a href="{% url 'reader:stream' %}" aria-label="Evection">
|
|
<img src="{% static 'img/brand-full-dark.png' %}" alt="Evection" class="brand-wordmark-dark">
|
|
<img src="{% static 'img/brand-full-light.png' %}" alt="Evection" class="brand-wordmark-light">
|
|
</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 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>
|
|
|
|
{% for entry in sidebar_tag_groups %}
|
|
<details class="sidebar-section" data-sidebar-key="tag-{{ entry.tag.pk }}" open>
|
|
<summary>
|
|
<span class="sidebar-tag-row">
|
|
<a href="{% url 'reader:stream' %}?tag={{ entry.tag.pk }}"
|
|
class="sidebar-tag-link{% if request.GET.tag == entry.tag.pk|stringformat:'s' %} active{% endif %}">{{ entry.tag.name }}</a>
|
|
{% if entry.unread_count %}<span class="unread-count">{{ entry.unread_count }}</span>{% endif %}
|
|
</span>
|
|
</summary>
|
|
{% if entry.subscriptions %}
|
|
<ul class="sidebar-item-list">
|
|
{% for subscription in entry.subscriptions %}
|
|
<li>
|
|
<a href="{% url 'reader:stream' %}?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>
|
|
{% endif %}
|
|
</details>
|
|
{% endfor %}
|
|
|
|
{% if sidebar_untagged %}
|
|
<details class="sidebar-section" data-sidebar-key="untagged" open>
|
|
<summary>Untagged</summary>
|
|
<ul class="sidebar-item-list">
|
|
{% for subscription in sidebar_untagged %}
|
|
<li>
|
|
<a href="{% url 'reader:stream' %}?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>
|
|
<form method="post" action="{% url 'accounts:logout' %}">
|
|
{% csrf_token %}
|
|
<button type="submit">Log out</button>
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="theme-switcher" role="group" aria-label="Theme">
|
|
<button type="button" data-theme-choice="light">Light</button>
|
|
<button type="button" data-theme-choice="dark">Dark</button>
|
|
<button type="button" data-theme-choice="system">System</button>
|
|
</div>
|
|
</nav>
|