Adds half star markup

This commit is contained in:
Mouse Reeve 2021-09-10 14:20:55 -07:00
parent 2665e3640e
commit 0be53f9133

View file

@ -20,6 +20,24 @@
</label> </label>
{% for i in '12345'|make_list %} {% for i in '12345'|make_list %}
<label
class="is-sr-only"
for="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter0 }}_half"
>
{% blocktranslate trimmed count rating=forloop.counter0 with half_rating=forloop.counter0|add:""|add:"0.5" %}
{{ 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 %}
/>
<input <input
id="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}" id="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}"
class="is-sr-only" class="is-sr-only"
@ -39,6 +57,7 @@
{% endif %} {% endif %}
" "
for="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}" for="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter }}"
data-for-half="{{ type|slugify }}_book{{ book.id }}_star_{{ forloop.counter0 }}_half"
> >
<span class="is-sr-only"> <span class="is-sr-only">
{% blocktranslate trimmed count rating=forloop.counter %} {% blocktranslate trimmed count rating=forloop.counter %}