moviewyrm/bookwyrm/templates/snippets/form_rate_stars.html
Mouse Reeve 21a954c7df Always use underscores in html ids
Plus some other shifting around
2021-08-08 19:44:12 -07:00

53 lines
1.5 KiB
HTML

{% spaceless %}
{% load i18n %}
<div class="
field is-grouped
stars form-rate-stars
{% if classes %}{{classes}}{% endif%}
">
<input
id="{{ type|slugify }}_{{ book.id }}_no_rating"
class="is-sr-only"
type="radio"
name="rating"
value=""
{% if default_rating == 0 or not default_rating %}checked{% endif %}
>
<label class="is-sr-only" for="{{ type|slugify }}_{{ book.id }}_no_rating">
{% trans "No rating" %}
</label>
{% for i in '12345'|make_list %}
<input
id="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}"
class="is-sr-only"
type="radio"
name="rating"
value="{{ forloop.counter }}"
{% if default_rating == forloop.counter %}checked{% endif %}
/>
<label
class="
icon
{% if forloop.counter <= default_rating %}
icon-star-full
{% else %}
icon-star-empty
{% endif %}
"
for="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}"
>
<span class="is-sr-only">
{% blocktranslate trimmed count rating=forloop.counter %}
{{ rating }} star
{% plural %}
{{ rating }} stars
{% endblocktranslate %}
</span>
</label>
{% endfor %}
</div>
{% endspaceless %}