2021-04-04 13:08:42 +00:00
|
|
|
{% spaceless %}
|
|
|
|
{% load i18n %}
|
2021-09-10 21:41:55 +00:00
|
|
|
{% load stars %}
|
2021-04-04 13:08:42 +00:00
|
|
|
|
|
|
|
<div class="
|
|
|
|
field is-grouped
|
|
|
|
stars form-rate-stars
|
|
|
|
{% if classes %}{{classes}}{% endif%}
|
|
|
|
">
|
|
|
|
<input
|
2021-08-09 01:40:47 +00:00
|
|
|
id="{{ type|slugify }}_{{ book.id }}_no_rating"
|
2021-04-04 13:08:42 +00:00
|
|
|
class="is-sr-only"
|
|
|
|
type="radio"
|
|
|
|
name="rating"
|
2021-06-18 00:47:46 +00:00
|
|
|
value=""
|
2021-04-04 16:05:21 +00:00
|
|
|
{% if default_rating == 0 or not default_rating %}checked{% endif %}
|
2021-04-04 13:08:42 +00:00
|
|
|
>
|
|
|
|
|
2021-08-09 01:40:47 +00:00
|
|
|
<label class="is-sr-only" for="{{ type|slugify }}_{{ book.id }}_no_rating">
|
2021-04-04 13:08:42 +00:00
|
|
|
{% trans "No rating" %}
|
|
|
|
</label>
|
|
|
|
|
|
|
|
{% for i in '12345'|make_list %}
|
2021-09-10 21:20:55 +00:00
|
|
|
<label
|
|
|
|
class="is-sr-only"
|
|
|
|
for="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter0 }}_half"
|
|
|
|
>
|
2021-09-10 21:41:55 +00:00
|
|
|
{% blocktranslate trimmed count rating=forloop.counter0 with half_rating=forloop.counter0|half_star %}
|
2021-09-10 21:20:55 +00:00
|
|
|
{{ half_rating }} star
|
|
|
|
{% plural %}
|
|
|
|
{{ half_rating }} stars
|
|
|
|
{% endblocktranslate %}
|
|
|
|
</label>
|
|
|
|
<input
|
|
|
|
id="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter0 }}_half"
|
|
|
|
class="is-sr-only half"
|
|
|
|
type="radio"
|
|
|
|
name="rating"
|
|
|
|
value="{{ forloop.counter0 }}.5"
|
|
|
|
{% if default_rating == forloop.counter %}checked{% endif %}
|
|
|
|
/>
|
2021-04-04 13:08:42 +00:00
|
|
|
<input
|
2021-08-09 01:40:47 +00:00
|
|
|
id="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}"
|
2021-04-04 13:08:42 +00:00
|
|
|
class="is-sr-only"
|
|
|
|
type="radio"
|
|
|
|
name="rating"
|
|
|
|
value="{{ forloop.counter }}"
|
2021-04-04 16:05:21 +00:00
|
|
|
{% if default_rating == forloop.counter %}checked{% endif %}
|
2021-04-04 13:08:42 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<label
|
|
|
|
class="
|
|
|
|
icon
|
2021-04-04 16:05:21 +00:00
|
|
|
{% if forloop.counter <= default_rating %}
|
2021-04-04 13:08:42 +00:00
|
|
|
icon-star-full
|
|
|
|
{% else %}
|
|
|
|
icon-star-empty
|
|
|
|
{% endif %}
|
|
|
|
"
|
2021-08-09 01:40:47 +00:00
|
|
|
for="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}"
|
2021-09-10 21:20:55 +00:00
|
|
|
data-for-half="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter0 }}_half"
|
2021-04-04 13:08:42 +00:00
|
|
|
>
|
|
|
|
<span class="is-sr-only">
|
|
|
|
{% blocktranslate trimmed count rating=forloop.counter %}
|
|
|
|
{{ rating }} star
|
|
|
|
{% plural %}
|
|
|
|
{{ rating }} stars
|
|
|
|
{% endblocktranslate %}
|
|
|
|
</span>
|
|
|
|
</label>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endspaceless %}
|