diff --git a/bookwyrm/activitystreams.py b/bookwyrm/activitystreams.py index 86321cd83..ff3c55fbd 100644 --- a/bookwyrm/activitystreams.py +++ b/bookwyrm/activitystreams.py @@ -55,6 +55,8 @@ class ActivityStream(RedisStore): return ( models.Status.objects.select_subclasses() .filter(id__in=statuses) + .select_related("user", "reply_parent") + .prefetch_related("mention_books", "mention_users") .order_by("-published_date") ) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 7d821c5ba..d9f3eba99 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -381,17 +381,16 @@ class AnnualGoal(BookWyrmModel): return {r.book.id: r.rating for r in reviews} @property - def progress_percent(self): - """how close to your goal, in percent form""" - return int(float(self.book_count / self.goal) * 100) - - @property - def book_count(self): + def progress(self): """how many books you've read this year""" - return self.user.readthrough_set.filter( + count = self.user.readthrough_set.filter( finish_date__year__gte=self.year, finish_date__year__lt=self.year + 1, ).count() + return { + "count": count, + "percent": int(float(count / self.goal) * 100), + } @app.task diff --git a/bookwyrm/static/css/bookwyrm.css b/bookwyrm/static/css/bookwyrm.css index fcb32e212..3db25d1fe 100644 --- a/bookwyrm/static/css/bookwyrm.css +++ b/bookwyrm/static/css/bookwyrm.css @@ -43,6 +43,19 @@ body { white-space: nowrap !important; width: 0.01em !important; } + + .m-0-mobile { + margin: 0 !important; + } + + .card-footer.is-stacked-mobile { + flex-direction: column; + } + + .card-footer.is-stacked-mobile .card-footer-item:not(:last-child) { + border-bottom: 1px solid #ededed; + border-right: 0; + } } .button.is-transparent { @@ -331,6 +344,49 @@ body { } } +/* Book list + ******************************************************************************/ + +ol.ordered-list { + list-style: none; + counter-reset: list-counter; +} + +ol.ordered-list li { + counter-increment: list-counter; +} + +ol.ordered-list li::before { + content: counter(list-counter); + position: absolute; + left: -20px; + width: 20px; + height: 24px; + background-color: #fff; + border: 1px solid #dbdbdb; + border-right: 0; + border-top-left-radius: 2px; + border-top-right-radius: 2px; + display: flex; + justify-content: center; + align-items: center; + color: #888; + font-size: 0.8em; + font-weight: bold; +} + +@media only screen and (max-width: 768px) { + ol.ordered-list li::before { + left: 0; + z-index: 1; + border: 0; + border-right: 1px solid #dbdbdb; + border-bottom: 1px solid #dbdbdb; + border-radius: 0; + border-bottom-right-radius: 2px; + } +} + /* Dimensions * @todo These could be in rem. ******************************************************************************/ diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index fb0a45101..df76d8e11 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -1,7 +1,7 @@ {% extends 'layout.html' %} {% load i18n %}{% load bookwyrm_tags %}{% load humanize %}{% load utilities %} -{% block title %}{{ book.title }}{% endblock %} +{% block title %}{{ book|title }}{% endblock %} {% block content %} {% with user_authenticated=request.user.is_authenticated can_edit_book=perms.bookwyrm.edit_book %} @@ -137,7 +137,7 @@ {# user's relationship to the book #}
{% blocktrans with path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}This edition is on your {{ shelf_name }} shelf.{% endblocktrans %} {% include 'snippets/shelf_selector.html' with current=shelf.shelf %} diff --git a/bookwyrm/templates/get_started/book_preview.html b/bookwyrm/templates/get_started/book_preview.html index 578fef708..d8941ad50 100644 --- a/bookwyrm/templates/get_started/book_preview.html +++ b/bookwyrm/templates/get_started/book_preview.html @@ -5,7 +5,7 @@
{% trans "This list is currently empty" %}
{% else %} -{% include 'snippets/book_titleby.html' %}
@@ -59,7 +60,7 @@