Fix feed display

This commit is contained in:
Mouse Reeve 2020-03-09 17:27:54 -07:00
parent 78fa9a3a20
commit 99a060311b
5 changed files with 19 additions and 5 deletions

View file

@ -20,7 +20,7 @@
</form> </form>
{% for review in user_reviews %} {% 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 %} {% endfor %}
</div> </div>
</div> </div>
@ -34,7 +34,7 @@
{% include 'snippets/book_cover.html' with book=book size=large %} {% include 'snippets/book_cover.html' with book=book size=large %}
<p>{{ active_tab }} rating: {{ rating | stars }}</p> <p>{{ active_tab }} rating: {{ rating | stars }}</p>
{% if description %} {% if book.description %}
<blockquote>{{ book.description | description }}</blockquote> <blockquote>{{ book.description | description }}</blockquote>
{% endif %} {% endif %}
<div> <div>
@ -62,7 +62,7 @@
</form> </form>
<p>Average rating: {{ rating | stars }}</p> <p>Average rating: {{ rating | stars }}</p>
{% for review in reviews %} {% 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 %} {% endfor %}
</div> </div>
</div> </div>

View file

@ -38,7 +38,7 @@
{% include 'snippets/tabs.html' with tabs=feed_tabs active_tab=active_tab %} {% include 'snippets/tabs.html' with tabs=feed_tabs active_tab=active_tab %}
{% for activity in activities %} {% 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 %} {% endfor %}
</div> </div>

View file

@ -1,7 +1,15 @@
{% load fr_display %}
<div class="interaction"> <div class="interaction">
{% if activity.favorites.all %} {% if activity.favorites.all %}
<span> <span>
{{ activity.favorites.count }} like(s) {{ activity.favorites.count }} like{{activity.favorites.count|pluralize }}
</span>
{% endif %}
{% if activity|reply_count %}
<span>
<a href="{{ activity.absolute_id }}">
{{ activity|reply_count }} repl{{ activity|reply_count|pluralize:'y,ies' }}
</a>
</span> </span>
{% endif %} {% endif %}
<form name="favorite" action="/favorite/{{ activity.id }}" method="post"> <form name="favorite" action="/favorite/{{ activity.id }}" method="post">

View file

@ -15,6 +15,7 @@
<small>{{ status.rating | stars }} stars, by {% include 'snippets/username.html' with user=status.user %}</small> <small>{{ status.rating | stars }} stars, by {% include 'snippets/username.html' with user=status.user %}</small>
</h4>{% endif %} </h4>{% endif %}
<blockquote>{{ status.content }}</blockquote> <blockquote>{{ status.content }}</blockquote>
{% if not max_depth and status.reply_parent or status|replies %}<p><a href="{{ status.absolute_id }}">Thread</a>{% endif %}
{% include 'snippets/interaction.html' with activity=status %} {% include 'snippets/interaction.html' with activity=status %}
</div> </div>

View file

@ -60,6 +60,11 @@ def get_replies(status):
return models.Status.objects.filter(reply_parent=status).select_subclasses().all()[:10] 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') @register.filter(name='parent')
def get_parent(status): def get_parent(status):
return models.Status.objects.filter(id=status.reply_parent_id).select_subclasses().get() return models.Status.objects.filter(id=status.reply_parent_id).select_subclasses().get()