From 99a060311b40ac6a626c9596fafa42bc3133feff Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 9 Mar 2020 17:27:54 -0700 Subject: [PATCH] Fix feed display --- fedireads/templates/book.html | 6 +++--- fedireads/templates/feed.html | 2 +- fedireads/templates/snippets/interaction.html | 10 +++++++++- fedireads/templates/snippets/status.html | 1 + fedireads/templatetags/fr_display.py | 5 +++++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/fedireads/templates/book.html b/fedireads/templates/book.html index f5f55f533..6453e8593 100644 --- a/fedireads/templates/book.html +++ b/fedireads/templates/book.html @@ -20,7 +20,7 @@ {% for review in user_reviews %} - {% include 'snippets/status.html' with status=review hide_book=True main=True depth=1 %} + {% include 'snippets/status.html' with status=review hide_book=True depth=1 %} {% endfor %} @@ -34,7 +34,7 @@ {% include 'snippets/book_cover.html' with book=book size=large %}

{{ active_tab }} rating: {{ rating | stars }}

- {% if description %} + {% if book.description %}
{{ book.description | description }}
{% endif %}
@@ -62,7 +62,7 @@

Average rating: {{ rating | stars }}

{% for review in reviews %} - {% include 'snippets/status.html' with status=review hide_book=True main=True depth=1 %} + {% include 'snippets/status.html' with status=review hide_book=True depth=1 %} {% endfor %}
diff --git a/fedireads/templates/feed.html b/fedireads/templates/feed.html index 314abc02d..aafad712a 100644 --- a/fedireads/templates/feed.html +++ b/fedireads/templates/feed.html @@ -38,7 +38,7 @@ {% include 'snippets/tabs.html' with tabs=feed_tabs active_tab=active_tab %} {% for activity in activities %} - {% include 'snippets/status.html' with status=activity depth=1 %} + {% include 'snippets/status.html' with status=activity depth=1 description=True %} {% endfor %} diff --git a/fedireads/templates/snippets/interaction.html b/fedireads/templates/snippets/interaction.html index 13ad6d684..2c44068df 100644 --- a/fedireads/templates/snippets/interaction.html +++ b/fedireads/templates/snippets/interaction.html @@ -1,7 +1,15 @@ +{% load fr_display %}
{% if activity.favorites.all %} - {{ activity.favorites.count }} like(s) + {{ activity.favorites.count }} like{{activity.favorites.count|pluralize }} + + {% endif %} + {% if activity|reply_count %} + + + {{ activity|reply_count }} repl{{ activity|reply_count|pluralize:'y,ies' }} + {% endif %}
diff --git a/fedireads/templates/snippets/status.html b/fedireads/templates/snippets/status.html index 19f04b239..545184b83 100644 --- a/fedireads/templates/snippets/status.html +++ b/fedireads/templates/snippets/status.html @@ -15,6 +15,7 @@ {{ status.rating | stars }} stars, by {% include 'snippets/username.html' with user=status.user %} {% endif %}
{{ status.content }}
+ {% if not max_depth and status.reply_parent or status|replies %}

Thread{% endif %} {% include 'snippets/interaction.html' with activity=status %}

diff --git a/fedireads/templatetags/fr_display.py b/fedireads/templatetags/fr_display.py index ac249c9c9..b8b390106 100644 --- a/fedireads/templatetags/fr_display.py +++ b/fedireads/templatetags/fr_display.py @@ -60,6 +60,11 @@ def get_replies(status): return models.Status.objects.filter(reply_parent=status).select_subclasses().all()[:10] +@register.filter(name='reply_count') +def get_reply_count(status): + return models.Status.objects.filter(reply_parent=status).count() + + @register.filter(name='parent') def get_parent(status): return models.Status.objects.filter(id=status.reply_parent_id).select_subclasses().get()