mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 09:31:08 +00:00
Merge pull request #2857 from bpeel/no-rating
Show “no rating” instead of blank stars if the review has no rating
This commit is contained in:
commit
d251f4201b
3 changed files with 27 additions and 22 deletions
|
@ -5,6 +5,10 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stars .no-rating {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
/** Stars in a review form
|
/** Stars in a review form
|
||||||
*
|
*
|
||||||
* Specificity makes hovering taking over checked inputs.
|
* Specificity makes hovering taking over checked inputs.
|
||||||
|
|
|
@ -190,13 +190,15 @@
|
||||||
<meta itemprop="bestRating" content="5">
|
<meta itemprop="bestRating" content="5">
|
||||||
<meta itemprop="reviewCount" content="{{ review_count }}">
|
<meta itemprop="reviewCount" content="{{ review_count }}">
|
||||||
|
|
||||||
{% include 'snippets/stars.html' with rating=rating %}
|
<span>
|
||||||
|
{% include 'snippets/stars.html' with rating=rating %}
|
||||||
|
|
||||||
{% blocktrans count counter=review_count trimmed %}
|
{% blocktrans count counter=review_count trimmed %}
|
||||||
({{ review_count }} review)
|
({{ review_count }} review)
|
||||||
{% plural %}
|
{% plural %}
|
||||||
({{ review_count }} reviews)
|
({{ review_count }} reviews)
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% with full=book|book_description itemprop='abstract' %}
|
{% with full=book|book_description itemprop='abstract' %}
|
||||||
|
|
|
@ -2,26 +2,25 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<span class="stars">
|
<span class="stars">
|
||||||
<span class="is-sr-only">
|
{% if rating %}
|
||||||
{% if rating %}
|
<span class="is-sr-only">
|
||||||
{% blocktranslate trimmed with rating=rating|floatformat:0 count counter=rating|floatformat:0|add:0 %}
|
{% blocktranslate trimmed with rating=rating|floatformat:0 count counter=rating|floatformat:0|add:0 %}
|
||||||
{{ rating }} star
|
{{ rating }} star
|
||||||
{% plural %}
|
{% plural %}
|
||||||
{{ rating }} stars
|
{{ rating }} stars
|
||||||
{% endblocktranslate %}
|
{% endblocktranslate %}
|
||||||
{% else %}
|
</span>
|
||||||
{% trans "No rating" %}
|
{% for i in '12345'|make_list %}
|
||||||
{% endif %}
|
<span
|
||||||
</span>
|
class="
|
||||||
|
icon is-small mr-1
|
||||||
{% for i in '12345'|make_list %}
|
icon-star-{% if rating >= forloop.counter %}full{% elif rating|floatformat:0 >= forloop.counter|floatformat:0 %}half{% else %}empty{% endif %}
|
||||||
<span
|
"
|
||||||
class="
|
aria-hidden="true"
|
||||||
icon is-small mr-1
|
></span>
|
||||||
icon-star-{% if rating >= forloop.counter %}full{% elif rating|floatformat:0 >= forloop.counter|floatformat:0 %}half{% else %}empty{% endif %}
|
{% endfor %}
|
||||||
"
|
{% else %}
|
||||||
aria-hidden="true"
|
<span class="no-rating">{% trans "No rating" %}</span>
|
||||||
></span>
|
{% endif %}
|
||||||
{% endfor %}
|
|
||||||
</span>
|
</span>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
Loading…
Reference in a new issue