moviewyrm/bookwyrm/templates/snippets/rate_action.html

34 lines
1.7 KiB
HTML
Raw Normal View History

2020-12-13 02:25:04 +00:00
{% load bookwyrm_tags %}
{% if request.user.is_authenticated %}
2020-09-30 22:10:37 +00:00
<span class="is-sr-only">Leave a rating</span>
2021-01-18 17:57:44 +00:00
<div class="block">
<form class="hidden-form" name="rate" action="/post/rating" method="POST">
2020-04-03 19:43:49 +00:00
{% csrf_token %}
2020-12-17 21:21:21 +00:00
<input type="hidden" name="user" value="{{ request.user.id }}">
2020-05-04 00:53:14 +00:00
<input type="hidden" name="book" value="{{ book.id }}">
2020-12-17 21:21:21 +00:00
<input type="hidden" name="privacy" value="public">
<input type="hidden" name="rating" value="{{ forloop.counter }}">
2021-01-18 17:57:44 +00:00
<div class="field is-grouped stars form-rate-stars mb-1 has-text-warning-dark">
2021-01-19 17:31:01 +00:00
<label class="is-sr-only" for="rating-no-rating-{{ book.id }}">No rating</label>
<input class="is-sr-only" type="radio" name="rating" value="" id="rating-no-rating-{{ book.id }}" checked>
2021-01-18 17:57:44 +00:00
{% for i in '12345'|make_list %}
2021-01-31 18:34:25 +00:00
<input class="is-sr-only" id="rating-book{{book.id}}-star-{{ forloop.counter }}" type="radio" name="rating" value="{{ forloop.counter }}" {% if book|user_rating:user == forloop.counter %}checked{% endif %}>
2021-01-19 17:31:01 +00:00
<label class="icon icon-star-empty" for="rating-book{{book.id}}-star-{{ forloop.counter }}">
2021-01-18 17:57:44 +00:00
<span class="is-sr-only">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>
</label>
{% endfor %}
</div>
<div class="field has-addons hidden">
<div class="control">
{% include 'snippets/privacy_select.html' with class="is-small" %}
</div>
<div class="control">
<button class="button is-small is-primary" type="submit">Rate</button>
</div>
</div>
2020-04-03 19:43:49 +00:00
</form>
</div>
{% endif %}