diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit_book.html index af5d4d695..1702cf5d8 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit_book.html @@ -109,7 +109,10 @@

{{ error | escape }}

{% endfor %} -

{{ form.series }}

+

+ + +

{% for error in form.series.errors %}

{{ error | escape }}

{% endfor %} diff --git a/bookwyrm/templates/lists/list.html b/bookwyrm/templates/lists/list.html index 2f0e7d678..a9f8e5c0e 100644 --- a/bookwyrm/templates/lists/list.html +++ b/bookwyrm/templates/lists/list.html @@ -30,26 +30,32 @@ {% include 'snippets/shelve_button/shelve_button.html' with book=item.book %} - diff --git a/bookwyrm/templates/snippets/status/content_status.html b/bookwyrm/templates/snippets/status/content_status.html index 5021ee067..5225f04e1 100644 --- a/bookwyrm/templates/snippets/status/content_status.html +++ b/bookwyrm/templates/snippets/status/content_status.html @@ -1,5 +1,3 @@ -{% spaceless %} - {% load bookwyrm_tags %} {% load i18n %} @@ -127,4 +125,4 @@ {% endwith %} -{% endspaceless %} + diff --git a/bookwyrm/templates/snippets/status/status_content.html b/bookwyrm/templates/snippets/status/status_content.html new file mode 100644 index 000000000..fd3c7ee70 --- /dev/null +++ b/bookwyrm/templates/snippets/status/status_content.html @@ -0,0 +1,134 @@ +{% load bookwyrm_tags %} +{% load i18n %} + +{% with status_type=status.status_type %} +
+ {% if status_type == 'Review' or status_type == 'Rating' %} +
+ {% if status.name %} +

+ {{ status.name|escape }} +

+ {% endif %} + + + + + {% if status_type == 'Rating' %} + {# @todo Is it possible to not hard-code the value? #} + + {% endif %} + + + {% include 'snippets/stars.html' with rating=status.rating %} +
+ {% endif %} + + {% if status.content_warning %} +
+

{{ status.content_warning }}

+ + {% trans "Show more" as button_text %} + + {% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %} + {% include 'snippets/toggle/open_button.html' %} + {% endwith %} +
+ {% endif %} + + +
+ +{% if not hide_book %} + {% if status.book or status.mention_books.count %} +
+ {% if status.book %} + {% with book=status.book %} + {% include 'snippets/status/book_preview.html' %} + {% endwith %} + {% elif status.mention_books.count %} + {% with book=status.mention_books.first %} + {% include 'snippets/status/book_preview.html' %} + {% endwith %} + {% endif %} +
+ {% endif %} +{% endif %} +{% endwith %} diff --git a/bookwyrm/templates/snippets/trimmed_text.html b/bookwyrm/templates/snippets/trimmed_text.html index 31c72eca3..0dd19e6ee 100644 --- a/bookwyrm/templates/snippets/trimmed_text.html +++ b/bookwyrm/templates/snippets/trimmed_text.html @@ -1,4 +1,3 @@ -{% spaceless %} {% load bookwyrm_tags %} {% load i18n %} @@ -46,4 +45,3 @@ {% endwith %} {% endif %} {% endwith %} -{% endspaceless %} diff --git a/bookwyrm/tests/views/test_user.py b/bookwyrm/tests/views/test_user.py index 055edae25..7518b2bf0 100644 --- a/bookwyrm/tests/views/test_user.py +++ b/bookwyrm/tests/views/test_user.py @@ -30,6 +30,14 @@ class UserViews(TestCase): self.rat = models.User.objects.create_user( "rat@local.com", "rat@rat.rat", "password", local=True, localname="rat" ) + self.book = models.Edition.objects.create(title="test") + with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): + models.ShelfBook.objects.create( + book=self.book, + user=self.local_user, + shelf=self.local_user.shelf_set.first(), + ) + models.SiteSettings.objects.create() self.anonymous_user = AnonymousUser self.anonymous_user.is_authenticated = False diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index 2a47c0d2b..0c61d1a20 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -270,10 +270,10 @@ class Editions(View): if request.GET.get("format"): filters["physical_format__iexact"] = request.GET.get("format") - editions = work.editions.order_by("-edition_rank").all() + editions = work.editions.order_by("-edition_rank") languages = set(sum([e.languages for e in editions], [])) - paginated = Paginator(editions.filter(**filters).all(), PAGE_LENGTH) + paginated = Paginator(editions.filter(**filters), PAGE_LENGTH) data = { "editions": paginated.get_page(request.GET.get("page")), "work": work, diff --git a/bookwyrm/views/user.py b/bookwyrm/views/user.py index 9c79a77c2..02db5971b 100644 --- a/bookwyrm/views/user.py +++ b/bookwyrm/views/user.py @@ -59,7 +59,7 @@ class User(View): { "name": user_shelf.name, "local_path": user_shelf.local_path, - "books": user_shelf.books[:3], + "books": user_shelf.books.all()[:3], "size": user_shelf.books.count(), } )