Merge pull request #404 from mouse-reeve/rate-action

Rate action
This commit is contained in:
Mouse Reeve 2020-12-17 13:25:35 -08:00 committed by GitHub
commit c4c01f4950
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -53,7 +53,7 @@ class Comment(Note):
@dataclass(init=False)
class Review(Comment):
''' a full book review '''
name: str
name: str = None
rating: int = None
type: str = 'Review'

View file

@ -1,4 +1,5 @@
{% with uuid as uuid %}
{% load bookwyrm_tags %}
{% with 0|uuid as uuid %}
<div class="control">
<div>
<input type="radio" class="toggle-control" name="sensitive" value="false" id="hide-spoilers-{{ uuid }}" {% if not parent_status.content_warning %}checked{% endif %}>

View file

@ -4,7 +4,9 @@
{% for i in '12345'|make_list %}
<form name="rate" action="/rate/" method="POST" onsubmit="return rate_stars(event)">
{% csrf_token %}
<input type="hidden" name="user" value="{{ request.user.id }}">
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="privacy" value="public">
<input type="hidden" name="rating" value="{{ forloop.counter }}">
<button type="submit" class="icon icon-star-{% if book|rating:user < forloop.counter %}empty{% else %}full{% endif %}">
<span class="is-sr-only">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>