mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-01 21:08:42 +00:00
Fixes star rating displays
This commit is contained in:
parent
49e94f8e8e
commit
a4d1985f86
13 changed files with 111 additions and 90 deletions
|
@ -91,6 +91,11 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||||
to write this so it's just a property '''
|
to write this so it's just a property '''
|
||||||
return cls.objects.filter(reply_parent=status).select_subclasses()
|
return cls.objects.filter(reply_parent=status).select_subclasses()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def status_type(self):
|
||||||
|
''' expose the type of status for the ui using activity type '''
|
||||||
|
return self.activity_serializer.__name__
|
||||||
|
|
||||||
def to_replies(self, **kwargs):
|
def to_replies(self, **kwargs):
|
||||||
''' helper function for loading AP serialized replies to a status '''
|
''' helper function for loading AP serialized replies to a status '''
|
||||||
return self.to_ordered_collection(
|
return self.to_ordered_collection(
|
||||||
|
|
|
@ -38,3 +38,18 @@ input.toggle-control {
|
||||||
input.toggle-control:checked ~ .toggle-content {
|
input.toggle-control:checked ~ .toggle-content {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- STARS --- */
|
||||||
|
.rate-stars button.icon {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.rate-stars:hover .icon:before {
|
||||||
|
content: '\e9d9';
|
||||||
|
}
|
||||||
|
.rate-stars form:hover ~ form .icon:before{
|
||||||
|
content: '\e9d7';
|
||||||
|
}
|
||||||
|
|
|
@ -2,39 +2,34 @@
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% include 'snippets/covers_shelf.html' with shelves=shelves user=request.user %}
|
<section class="section" id="feed">
|
||||||
|
<div class="container">
|
||||||
|
{% for activity in activities %}
|
||||||
|
<div class="card">
|
||||||
|
{% include 'snippets/status.html' with status=activity %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="content-container pagination row">
|
||||||
|
{% if prev %}
|
||||||
|
<p>
|
||||||
|
<a href="{{ prev }}">
|
||||||
|
<span class="icon icon-arrow-left"></span>
|
||||||
|
Previous
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div id="feed">
|
{% if next %}
|
||||||
<div class="content-container tabs">
|
<p class="next">
|
||||||
{% include 'snippets/tabs.html' with tabs=feed_tabs active_tab=active_tab %}
|
<a href="{{ next }}">
|
||||||
|
Next
|
||||||
|
<span class="icon icon-arrow-right"></span>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
{% for activity in activities %}
|
|
||||||
<div class="content-container">
|
|
||||||
{% include 'snippets/status.html' with status=activity %}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div class="content-container pagination row">
|
|
||||||
{% if prev %}
|
|
||||||
<p>
|
|
||||||
<a href="{{ prev }}">
|
|
||||||
<span class="icon icon-arrow-left"></span>
|
|
||||||
Previous
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if next %}
|
|
||||||
<p class="next">
|
|
||||||
<a href="{{ next }}">
|
|
||||||
Next
|
|
||||||
<span class="icon icon-arrow-right"></span>
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
<div id="main">
|
<div>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<img class="user-pic{% if large %} large{% endif %}" src="{% if user.avatar %}/images/{{ user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}">
|
<img class="image {% if large %}is-96x96{% else %}is-32x32{% endif %}" src="{% if user.avatar %}/images/{{ user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}">
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
|
|
||||||
{% for shelf in shelves %}
|
{% for shelf in shelves %}
|
||||||
{% for book in shelf.books %}
|
{% for book in shelf.books %}
|
||||||
<div class="compose-popout">
|
<div class="compose-popout toggle-content hidden">
|
||||||
<input name="book-popout" type="radio" id="book-{{ book.id }}-radio">
|
<input class="toggle-control" name="book-popout" type="radio" id="book-{{ book.id }}-radio">
|
||||||
<div class="compose compose-suggestion" id="compose-book-{{ book.id }}">
|
<div class="compose compose-suggestion" id="compose-book-{{ book.id }}">
|
||||||
<label class="close icon icon-close" for="book-{{ book.id }}-radio-close" onclick="hide_element(this)">
|
<label class="close icon icon-close" for="book-{{ book.id }}-radio-close" onclick="hide_element(this)">
|
||||||
<span class="hidden-text">Close</span>
|
<span class="hidden-text">Close</span>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
<div class="interaction">
|
<div class="nav level">
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
<form name="reply" action="/reply" method="post" onsubmit="return reply(event)">
|
<form name="reply" action="/reply" method="post" onsubmit="return reply(event)">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
<span class="hidden-text">Leave a rating</span>
|
<span class="hidden-text">Leave a rating</span>
|
||||||
<div class="stars rate-stars">
|
<div class="field is-grouped stars rate-stars">
|
||||||
{% for i in '12345'|make_list %}
|
{% for i in '12345'|make_list %}
|
||||||
<form name="rate" action="/rate/" method="POST" onsubmit="return rate_stars(event)">
|
<form name="rate" action="/rate/" method="POST" onsubmit="return rate_stars(event)">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
<span class="hidden-text">Rating</span>
|
<span class="hidden-text">Rating</span>
|
||||||
<div class="stars rate-stars">
|
<div class="field is-grouped stars rate-stars">
|
||||||
<input type="radio" name="rating" value="" checked>
|
<input type="radio" name="rating" value="" checked>
|
||||||
{% for i in '12345'|make_list %}
|
{% for i in '12345'|make_list %}
|
||||||
<input id="book{{book.id}}-star-{{ forloop.counter }}" type="radio" name="rating" value="{{ forloop.counter }}">
|
<input id="book{{book.id}}-star-{{ forloop.counter }}" type="radio" name="rating" value="{{ forloop.counter }}">
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
|
|
||||||
<div class="pulldown-button">
|
<div class="dropdown is-hoverable">
|
||||||
<form name="shelve" action="/shelve/" method="post">
|
<form name="shelve" action="/shelve/" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
<input type="hidden" name="book" value="{{ book.id }}">
|
||||||
<input type="hidden" name="shelf" value="{% shelve_button_identifier book %}">
|
<input type="hidden" name="shelf" value="{% shelve_button_identifier book %}">
|
||||||
<button type="submit" style="">{% shelve_button_text book %}</button>
|
<button class="button" type="submit" style="">{% shelve_button_text book %}</button>
|
||||||
</form>
|
</form>
|
||||||
{% if not hide_pulldown %}
|
<div class="button dropdown-trigger" >
|
||||||
<div class="pulldown-container">
|
|
||||||
<button class="pulldown-toggle">
|
|
||||||
<span class="icon icon-arrow-down"><span class="hidden-text">More shelves</span></span>
|
<span class="icon icon-arrow-down"><span class="hidden-text">More shelves</span></span>
|
||||||
</button>
|
</div>
|
||||||
<ul class="pulldown">
|
|
||||||
<form name="shelve" action="/shelve/" method="post">
|
{% if not hide_pulldown %}
|
||||||
{% csrf_token %}
|
<div class="dropdown-menu">
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
<ul class="dropdown-content">
|
||||||
{% for shelf in request.user.shelf_set.all %}
|
<form name="shelve" action="/shelve/" method="post">
|
||||||
<li>
|
{% csrf_token %}
|
||||||
<button name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>{{ shelf.name }} {% if shelf in book.shelf_set.all %} ✓ {% endif %}</button>
|
<input type="hidden" name="book" value="{{ book.id }}">
|
||||||
</li>
|
{% for shelf in request.user.shelf_set.all %}
|
||||||
{% endfor %}
|
<li>
|
||||||
</form>
|
<button name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>{{ shelf.name }} {% if shelf in book.shelf_set.all %} ✓ {% endif %}</button>
|
||||||
</ul>
|
</li>
|
||||||
</div>
|
{% endfor %}
|
||||||
{% endif %}
|
</form>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
|
|
||||||
<div class="post {{ status.status_type | lower }} depth-{{ depth }} {% if main %}main{% else %}reply{% endif %}">
|
<div class="post{% if depth %}depth-{{ depth }} {% if main %}main{% else %}reply{% endif %}{% endif %}">
|
||||||
|
<h2 class="level">
|
||||||
<h2>
|
|
||||||
{% if status.boosted_status %}
|
{% if status.boosted_status %}
|
||||||
{% include 'snippets/status_header.html' with status=status.boosted_status %}
|
{% include 'snippets/status_header.html' with status=status.boosted_status %}
|
||||||
<small class="subhead">{% include 'snippets/status_header.html' with status=status %}</small>
|
<small class="subhead">{% include 'snippets/status_header.html' with status=status %}</small>
|
||||||
|
|
|
@ -23,16 +23,16 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="media">
|
||||||
{% if not hide_book and status.book %}
|
{% if not hide_book and status.book %}
|
||||||
<div class="cover-container">
|
<div class="media-left">
|
||||||
{% include 'snippets/book_cover.html' with book=status.book %}
|
{% include 'snippets/book_cover.html' with book=status.book %}
|
||||||
{% include 'snippets/rate_action.html' with book=status.book user=request.user %}
|
{% include 'snippets/rate_action.html' with book=status.book user=request.user %}
|
||||||
{% include 'snippets/shelve_button.html' with book=status.book %}
|
{% include 'snippets/shelve_button.html' with book=status.book %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div>
|
<div class="media-content">
|
||||||
{% if status.status_type == 'Review' %}
|
{% if status.status_type == 'Review' %}
|
||||||
<h3>
|
<h3>
|
||||||
{% if status.name %}{{ status.name }}<br>{% endif %}
|
{% if status.name %}{{ status.name }}<br>{% endif %}
|
||||||
|
|
|
@ -1,25 +1,31 @@
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% load fr_display %}
|
{% load fr_display %}
|
||||||
{% include 'snippets/avatar.html' with user=status.user %}
|
<div class="level-left">
|
||||||
{% include 'snippets/username.html' with user=status.user %}
|
<div>
|
||||||
|
{% include 'snippets/avatar.html' with user=status.user %}
|
||||||
|
|
||||||
{% if status.status_type == 'Update' %}
|
{% include 'snippets/username.html' with user=status.user %}
|
||||||
{{ status.content | safe }}
|
{% if status.status_type == 'Update' %}
|
||||||
{% elif status.status_type == 'Review' and not status.name and not status.content%}
|
{{ status.content | safe }}
|
||||||
rated <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
{% elif status.status_type == 'Review' and not status.name and not status.content%}
|
||||||
{% elif status.status_type == 'Review' %}
|
rated <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
||||||
reviewed <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
{% elif status.status_type == 'Review' %}
|
||||||
{% elif status.status_type == 'Comment' %}
|
reviewed <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
||||||
commented on <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
{% elif status.status_type == 'Comment' %}
|
||||||
{% elif status.status_type == 'Quotation' %}
|
commented on <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
||||||
quoted <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
{% elif status.status_type == 'Quotation' %}
|
||||||
{% elif status.status_type == 'Boost' %}
|
quoted <a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
||||||
boosted
|
{% elif status.status_type == 'Boost' %}
|
||||||
{% elif status.reply_parent %}
|
boosted
|
||||||
{% with parent_status=status|parent %}
|
{% elif status.reply_parent %}
|
||||||
replied to {% include 'snippets/username.html' with user=parent_status.user possessive=True %} <a href="{{parent_status.remote_id }}">{{ parent_status.status_type | lower }}</a>
|
{% with parent_status=status|parent %}
|
||||||
{% endwith %}
|
replied to {% include 'snippets/username.html' with user=parent_status.user possessive=True %} <a href="{{parent_status.remote_id }}">{{ parent_status.status_type | lower }}</a>
|
||||||
{% endif %}
|
{% endwith %}
|
||||||
<span class="time-ago">
|
{% endif %}
|
||||||
<a href="{{ status.remote_id }}">{{ status.published_date | naturaltime }}</a>
|
</div>
|
||||||
</span>
|
</div>
|
||||||
|
<div class="level-right">
|
||||||
|
<div>
|
||||||
|
<a href="{{ status.remote_id }}">{{ status.published_date | naturaltime }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue