bookwyrm/bookwyrm/templates/snippets/goal_progress.html
Mouse Reeve 368d2cd716 Reduces feed page queries for goals
9 fewer queries
2021-05-22 17:34:16 -07:00

20 lines
987 B
HTML

{% load i18n %}
{% load humanize %}
{% with goal.progress as progress %}
<p>
{% if progress.percent >= 100 %}
{% trans "Success!" %}
{% elif progress.percent %}
{% blocktrans with percent=progress.percent %}{{ percent }}% complete!{% endblocktrans %}
{% endif %}
{% if goal.user == request.user %}
{% blocktrans with read_count=progress.count|intcomma goal_count=goal.goal|intcomma path=goal.local_path %}You've read <a href="{{ path }}">{{ read_count }} of {{ goal_count}} books</a>.{% endblocktrans %}
{% else %}
{% blocktrans with username=goal.user.display_name read_count=progress.count|intcomma goal_count=goal.goal|intcomma path=goal.local_path %}{{ username }} has read <a href="{{ path }}">{{ read_count }} of {{ goal_count}} books</a>.{% endblocktrans %}
{% endif %}
</p>
<progress class="progress is-large" value="{{ progress.count }}" max="{{ goal.goal }}" aria-hidden="true">{{ progress.percent }}%</progress>
{% endwith %}