diff --git a/bookwyrm/templates/discover/discover.html b/bookwyrm/templates/discover/discover.html index 0a419e51b..01ef21869 100644 --- a/bookwyrm/templates/discover/discover.html +++ b/bookwyrm/templates/discover/discover.html @@ -5,50 +5,85 @@ {% block content %} -
-

{% trans "Discover" %}

-
+
+
+

{% trans "Discover" %}

+

+ {% blocktrans trimmed with site_name=site.name %} + See what's new in the local {{ site_name }} community + {% endblocktrans %} +

+
-
-
-
+
+
- {% include 'discover/large-book.html' with status=large.0 %} + {% include 'discover/large-book.html' with status=large_activities.0 %}
-
-
+
+
+ {% include 'discover/large-book.html' with status=large_activities.1 %} +
+
+
+ +
+
+
- {% include 'discover/small-book.html' with status=small.0 %} + {% include 'discover/large-book.html' with status=large_activities.2 %}
-
+
+
+
+ {% include 'discover/small-book.html' with status=small_activities.0 %} +
+
+
+
+ {% include 'discover/small-book.html' with status=small_activities.1 %} +
+
+
+
+
+
+
+
+ {% include 'discover/small-book.html' with status=small_activities.2 %} +
+
+
+
+ {% include 'discover/small-book.html' with status=small_activities.3 %} +
+
+
+
- {% include 'discover/small-book.html' with status=small.1 %} + {% include 'discover/large-book.html' with status=large_activities.3 %}
-
-
-
-
- {% include 'discover/small-book.html' with status=small.2 %} -
-
-
-
- {% include 'discover/small-book.html' with status=small.3 %} -
+ +
+
+
+ {% include 'discover/large-book.html' with status=large_activities.4 %}
-
+
- {% include 'discover/large-book.html' with status=large.1 %} + {% include 'discover/large-book.html' with status=large_activities.5 %}
- +
+ {% include 'snippets/pagination.html' with page=large_activities %} +
{% endblock %} diff --git a/bookwyrm/templates/discover/large-book.html b/bookwyrm/templates/discover/large-book.html index b273d4318..81620be1c 100644 --- a/bookwyrm/templates/discover/large-book.html +++ b/bookwyrm/templates/discover/large-book.html @@ -1,37 +1,67 @@ {% load bookwyrm_tags %} -{% load markdown %} {% load i18n %} -{% if book %} - {% with book=book %} +{% if status %} + {% with book=status.book %}
-
+
{% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-w-auto-tablet' %} {% include 'snippets/stars.html' with rating=book|rating:request.user %} -
- - -
-

+

{{ book.title }}

{% if book.authors %} -

- {% trans "by" %} - {% include 'snippets/authors.html' with limit=3 %} -

+

+ {% trans "by" %} + {% include 'snippets/authors.html' with limit=3 %} +

{% endif %} - {% if book|book_description %} -
- {{ book|book_description|to_markdown|safe|truncatewords_html:50 }} -
- {% endif %} + {% include 'snippets/shelve_button/shelve_button.html' %} +
+ +
+
+ +
+

+ + {{ status.user.display_name }} + + + {% if status.status_type == 'GeneratedNote' %} + {{ status.content|safe }} + {% elif status.status_type == 'Rating' %} + {% trans "rated" %} + {% elif status.status_type == 'Review' %} + {% trans "reviewed" %} + {% elif status.status_type == 'Comment' %} + {% trans "commented on" %} + {% elif status.status_type == 'Quotation' %} + {% trans "quoted" %} + {% endif %} + + {{ book.title }} +

+
+
+ +
+ {% include 'snippets/follow_button.html' with user=status.user show_username=True minimal=True %} +
+ +
+ {% include "snippets/status/content_status.html" with hide_book=True %} +
{% endwith %} diff --git a/bookwyrm/templates/discover/small-book.html b/bookwyrm/templates/discover/small-book.html index 052a540cf..1318c8bdc 100644 --- a/bookwyrm/templates/discover/small-book.html +++ b/bookwyrm/templates/discover/small-book.html @@ -5,23 +5,14 @@ {% if status %} {% with book=status.book %} - {% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-h-l-tablet is-w-auto align to-b to-l' %} + {% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-w-auto align to-b to-l' %} - {% include 'snippets/stars.html' with rating=book|rating:request.user %} +
+ {% include 'snippets/shelve_button/shelve_button.html' %} +
-

- {{ book.title }} -

- - {% if book.authors %} -

- {% trans "by" %} - {% include 'snippets/authors.html' with limit=3 %} -

- {% endif %} - -
+
-

+

{{ status.user.display_name }} + + {% if status.status_type == 'GeneratedNote' %} + {{ status.content|safe }} + {% elif status.status_type == 'Rating' %} + {% trans "rated" %} + {% elif status.status_type == 'Review' %} + {% trans "reviewed" %} + {% elif status.status_type == 'Comment' %} + {% trans "commented on" %} + {% elif status.status_type == 'Quotation' %} + {% trans "quoted" %} + {% endif %} + + {{ book.title }}

+ {% if status.rating %} +

+ {% include 'snippets/stars.html' with rating=status.rating %} +

+ {% endif %}
+
+ {% include 'snippets/follow_button.html' with user=status.user show_username=True minimal=True %} +
{% endwith %} {% endif %} diff --git a/bookwyrm/templates/snippets/follow_button.html b/bookwyrm/templates/snippets/follow_button.html index 0cbe6b8cd..8cafad7f9 100644 --- a/bookwyrm/templates/snippets/follow_button.html +++ b/bookwyrm/templates/snippets/follow_button.html @@ -9,15 +9,29 @@
diff --git a/bookwyrm/views/discover.py b/bookwyrm/views/discover.py index 685a4ded7..0b1fae2b5 100644 --- a/bookwyrm/views/discover.py +++ b/bookwyrm/views/discover.py @@ -7,7 +7,6 @@ from django.utils.decorators import method_decorator from django.views import View from bookwyrm import models -from bookwyrm.settings import PAGE_LENGTH from .helpers import privacy_filter @@ -24,13 +23,20 @@ class Discover(View): Q(comment__isnull=False) | Q(review__isnull=False) | Q(quotation__isnull=False), - user__local=True + user__local=True, ), - #privacy_levels=["public"] + privacy_levels=["public"], ) - #paginated = Paginator(activities, PAGE_LENGTH) + large_activities = Paginator( + activities.filter(~Q(content=None), ~Q(content="")), 6 + ) + small_activities = Paginator( + activities.filter(Q(content=None) | Q(content="")), 4 + ) + + page = request.GET.get("page") data = { - "large": activities.filter(~Q(review__isnull=True, review__content=None))[:2], - "small": activities.filter(~Q(content=None))[:4], + "large_activities": large_activities.get_page(page), + "small_activities": small_activities.get_page(page), } return TemplateResponse(request, "discover/discover.html", data)