Adds ratings
This commit is contained in:
14
fedireads/templates/snippets/rate_action.html
Normal file
14
fedireads/templates/snippets/rate_action.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% load fr_display %}
|
||||
<span class="hidden-text">Leave a rating</span>
|
||||
<div class="stars rate-stars">
|
||||
{% for i in '12345'|make_list %}
|
||||
<form name="rate" action="/rate/" method="POST" onsubmit="interact(event)">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.fedireads_key }}"></input>
|
||||
<input type="hidden" name="rating" value="{{ forloop.counter }}"></input>
|
||||
<button type="submit" class="icon icon-star-{% if book|rating:user < forloop.counter %}empty{% else %}full{% endif %}">
|
||||
<span class="hidden-text">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>
|
||||
</button>
|
||||
</form>
|
||||
{% endfor %}
|
||||
</div>
|
9
fedireads/templates/snippets/stars.html
Normal file
9
fedireads/templates/snippets/stars.html
Normal file
@ -0,0 +1,9 @@
|
||||
<span class="hidden-text">Leave a rating</span>
|
||||
<div class="stars">
|
||||
{% for i in '12345'|make_list %}
|
||||
<span class="icon icon-star-{% if rating < forloop.counter %}empty{% else %}full{% endif %}">
|
||||
<span class="hidden-text">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -1,5 +1,15 @@
|
||||
{% load fr_display %}
|
||||
|
||||
{% if status.status_type == 'Review' and not status.name or not status.content %}
|
||||
<div class="post rating">
|
||||
<h2>
|
||||
{% include 'snippets/status_header.html' with status=status %}
|
||||
{% include 'snippets/stars.html' with book=book rating=status.rating %}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="post {{ status.status_type | lower }} depth-{{ depth }} {% if main %}main{% else %}reply{% endif %}">
|
||||
|
||||
<h2>
|
||||
@ -22,3 +32,4 @@
|
||||
{% include 'snippets/interaction.html' with activity=status %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
{% if status.status_type == 'Update' %}
|
||||
{{ status.content | safe }}
|
||||
{% elif status.status_type == 'Review' and not status.name and not status.content%}
|
||||
rated <a href="{{ status.book.absolute_id }}">{{ status.book.title }}</a>
|
||||
{% elif status.status_type == 'Review' %}
|
||||
reviewed {{ status.book.title }}
|
||||
{% elif status.status_type == 'Comment' %}
|
||||
|
Reference in New Issue
Block a user