Private
Public Access
Show each tag's total unread count and remember collapsed sections
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>
This commit is contained in:
1 parent
9439f9cc59
commit
e760eeda1d
7 files changed
+186
-6
No files matched your search
+4
-1
@@ -53,7 +53,10 @@
|
||||
{% endif %}
|
||||
|
||||
<script src="{% static 'js/stream.js' %}" defer></script>
|
||||
{% if user.is_authenticated %}<script src="{% static 'js/theme.js' %}" defer></script>{% endif %}
|
||||
{% if user.is_authenticated %}
|
||||
<script src="{% static 'js/theme.js' %}" defer></script>
|
||||
<script src="{% static 'js/sidebar-state.js' %}" defer></script>
|
||||
{% endif %}
|
||||
<script src="{% static 'js/register-sw.js' %}" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -31,10 +31,13 @@
|
||||
</ul>
|
||||
|
||||
{% for entry in sidebar_tag_groups %}
|
||||
<details class="sidebar-section" open>
|
||||
<details class="sidebar-section" data-sidebar-key="tag-{{ entry.tag.pk }}" open>
|
||||
<summary>
|
||||
<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>
|
||||
<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">
|
||||
@@ -54,7 +57,7 @@
|
||||
{% endfor %}
|
||||
|
||||
{% if sidebar_untagged %}
|
||||
<details class="sidebar-section" open>
|
||||
<details class="sidebar-section" data-sidebar-key="untagged" open>
|
||||
<summary>Untagged</summary>
|
||||
<ul class="sidebar-item-list">
|
||||
{% for subscription in sidebar_untagged %}
|
||||
|
||||
Reference in new issue
Block a user