mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Fixes labels
This commit is contained in:
parent
daf42a30da
commit
8840e09eac
2 changed files with 13 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
{% spaceless %}
|
||||
{% load i18n %}
|
||||
{% load stars %}
|
||||
|
||||
<div class="
|
||||
field is-grouped
|
||||
|
@ -24,7 +25,7 @@
|
|||
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" %}
|
||||
{% blocktranslate trimmed count rating=forloop.counter0 with half_rating=forloop.counter0|half_star %}
|
||||
{{ half_rating }} star
|
||||
{% plural %}
|
||||
{{ half_rating }} stars
|
||||
|
|
11
bookwyrm/templatetags/stars.py
Normal file
11
bookwyrm/templatetags/stars.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
""" template filters """
|
||||
from django import template
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter(name="half_star")
|
||||
def get_half_star(value):
|
||||
"""one of those things that's weirdly hard with templates"""
|
||||
return f"{value}.5"
|
Loading…
Reference in a new issue