mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
Pass existing rating to stars form element as variable
This commit is contained in:
parent
4c2f1db6a6
commit
521f917d01
2 changed files with 4 additions and 4 deletions
|
@ -13,7 +13,7 @@
|
|||
type="radio"
|
||||
name="rating"
|
||||
value="0"
|
||||
{% if book|user_rating:user == 0 %}checked{% endif %}
|
||||
{% if default_rating == 0 or not default_rating %}checked{% endif %}
|
||||
>
|
||||
|
||||
<label class="is-sr-only" for="{{ type|slugify }}-{{ book.id }}-no-rating">
|
||||
|
@ -27,13 +27,13 @@
|
|||
type="radio"
|
||||
name="rating"
|
||||
value="{{ forloop.counter }}"
|
||||
{% if book|user_rating:user == forloop.counter %}checked{% endif %}
|
||||
{% if default_rating == forloop.counter %}checked{% endif %}
|
||||
/>
|
||||
|
||||
<label
|
||||
class="
|
||||
icon
|
||||
{% if forloop.counter <= book|user_rating:user %}
|
||||
{% if forloop.counter <= default_rating %}
|
||||
icon-star-full
|
||||
{% else %}
|
||||
icon-star-empty
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="privacy" value="public">
|
||||
|
||||
{% include 'snippets/form_rate_stars.html' with book=book classes='mb-1 has-text-warning-dark' %}
|
||||
{% include 'snippets/form_rate_stars.html' with book=book classes='mb-1 has-text-warning-dark' default_rating=book|user_rating:request.user %}
|
||||
|
||||
<div class="field has-addons hidden">
|
||||
<div class="control">
|
||||
|
|
Loading…
Reference in a new issue