mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-09-26 13:30:13 +00:00
603b2d9502
The stars.html template now outputs a span containing “no rating” when the stars represent a non-existent or zero rating. This text is already translated because it was previously added as a invisible text only for screen readers. The span is given a special CSS class so that it can be styled as italic in the stylesheet. There is now also an extra span in book.html to group the stars with the “(2 reviews)” text. This is needed because the outer div is using a flex layout and it eats the spacing between the two parts otherwise. Fixes #2856
26 lines
870 B
HTML
26 lines
870 B
HTML
{% spaceless %}
|
|
{% load i18n %}
|
|
|
|
<span class="stars">
|
|
{% if rating %}
|
|
<span class="is-sr-only">
|
|
{% blocktranslate trimmed with rating=rating|floatformat:0 count counter=rating|floatformat:0|add:0 %}
|
|
{{ rating }} star
|
|
{% plural %}
|
|
{{ rating }} stars
|
|
{% endblocktranslate %}
|
|
</span>
|
|
{% for i in '12345'|make_list %}
|
|
<span
|
|
class="
|
|
icon is-small mr-1
|
|
icon-star-{% if rating >= forloop.counter %}full{% elif rating|floatformat:0 >= forloop.counter|floatformat:0 %}half{% else %}empty{% endif %}
|
|
"
|
|
aria-hidden="true"
|
|
></span>
|
|
{% endfor %}
|
|
{% else %}
|
|
<span class="no-rating">{% trans "No rating" %}</span>
|
|
{% endif %}
|
|
</span>
|
|
{% endspaceless %}
|