Show current rating in interaction rating

This commit is contained in:
Mouse Reeve 2020-04-03 13:36:56 -07:00
parent a27effd05d
commit d91b77f49e
6 changed files with 5 additions and 9 deletions

View File

@ -333,9 +333,6 @@ button .icon {
margin: 0; margin: 0;
color: black; color: black;
} }
.rate-stars form > .icon:before {
content: '\e9d7';
}
.rate-stars:hover .icon:before { .rate-stars:hover .icon:before {
content: '\e9d9'; content: '\e9d9';
} }

View File

@ -49,7 +49,7 @@
</td> </td>
{% if ratings %} {% if ratings %}
<td> <td>
{{ ratings | dict_key:book.id | stars}} {% include 'snippets/stars.html' with rating=ratings|dict_key:book.id %}
</td> </td>
{% endif %} {% endif %}
</tr> </tr>

View File

@ -1,7 +1,7 @@
<span class="hidden-text">Leave a rating</span> <span class="hidden-text">Leave a rating</span>
<div class="stars"> <div class="stars">
{% for i in '12345'|make_list %} {% for i in '12345'|make_list %}
<span class="icon icon-star-{% if rating < forloop.counter %}empty{% else %}full{% endif %}"> <span class="icon icon-star-{% if rating < forloop.counter %}empty{% elif rating|floatformat < forloop.counter %}half{% else %}full{% endif %}">
<span class="hidden-text">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span> <span class="hidden-text">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>
</span> </span>
{% endfor %} {% endfor %}

View File

@ -34,7 +34,7 @@
{% if status.status_type == 'Review' %} {% if status.status_type == 'Review' %}
<h3> <h3>
{{ status.name }}<br> {{ status.name }}<br>
{{ status.rating | stars }} {% include 'snippets/stars.html' with rating=status.rating %}
</h3> </h3>
{% endif %} {% endif %}

View File

@ -8,9 +8,9 @@
{% elif status.status_type == 'Review' and not status.name and not status.content%} {% elif status.status_type == 'Review' and not status.name and not status.content%}
rated <a href="{{ status.book.absolute_id }}">{{ status.book.title }}</a> rated <a href="{{ status.book.absolute_id }}">{{ status.book.title }}</a>
{% elif status.status_type == 'Review' %} {% elif status.status_type == 'Review' %}
reviewed {{ status.book.title }} reviewed <a href="{{ status.book.absolute_id }}">{{ status.book.title }}</a>
{% elif status.status_type == 'Comment' %} {% elif status.status_type == 'Comment' %}
commented on {{ status.book.title }} commented on <a href="{{ status.book.absolute_id }}">{{ status.book.title }}</a>
{% elif status.status_type == 'Boost' %} {% elif status.status_type == 'Boost' %}
boosted boosted
{% elif status.reply_parent %} {% elif status.reply_parent %}

View File

@ -192,7 +192,6 @@ def rate(request):
form = forms.RatingForm(request.POST) form = forms.RatingForm(request.POST)
book_identifier = request.POST.get('book') book_identifier = request.POST.get('book')
# TODO: better failure behavior # TODO: better failure behavior
import pdb;pdb.set_trace()
if not form.is_valid(): if not form.is_valid():
return redirect('/book/%s' % book_identifier) return redirect('/book/%s' % book_identifier)