From 66250e0dd8e3faf55d692f5e1f5b72c4b18b2289 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 6 Aug 2023 15:36:56 -0700 Subject: [PATCH 1/5] Consistent null states and page titles in user profile views --- bookwyrm/templates/lists/list_items.html | 3 +++ bookwyrm/templates/lists/lists.html | 2 -- bookwyrm/templates/user/goal.html | 6 +++++- bookwyrm/templates/user/groups.html | 9 +++++++++ bookwyrm/templates/user/lists.html | 5 +++++ bookwyrm/templates/user/reviews_comments.html | 6 ++++-- bookwyrm/templates/user/user.html | 2 +- 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/bookwyrm/templates/lists/list_items.html b/bookwyrm/templates/lists/list_items.html index 1191a6264..2c4ca1227 100644 --- a/bookwyrm/templates/lists/list_items.html +++ b/bookwyrm/templates/lists/list_items.html @@ -47,4 +47,7 @@ {% endfor %} + {% if not lists or not lists.exists %} +

{% trans "No lists found." %}

+ {% endif %} diff --git a/bookwyrm/templates/lists/lists.html b/bookwyrm/templates/lists/lists.html index db6cc45f3..9103d4705 100644 --- a/bookwyrm/templates/lists/lists.html +++ b/bookwyrm/templates/lists/lists.html @@ -43,7 +43,6 @@ {% endif %} -{% if lists %}
{% include 'lists/list_items.html' with lists=lists %}
@@ -51,7 +50,6 @@
{% include 'snippets/pagination.html' with page=lists path=path %}
-{% endif %} {% endblock %} diff --git a/bookwyrm/templates/user/goal.html b/bookwyrm/templates/user/goal.html index f3547243a..b032cacaa 100644 --- a/bookwyrm/templates/user/goal.html +++ b/bookwyrm/templates/user/goal.html @@ -1,6 +1,10 @@ {% extends 'user/layout.html' %} -{% load i18n %} {% load utilities %} +{% load i18n %} + +{% block title %} +{% trans "Reading Goal" %} - {{ user|username }} +{% endblock %} {% block header %}
diff --git a/bookwyrm/templates/user/groups.html b/bookwyrm/templates/user/groups.html index 133739149..1e00bfe33 100644 --- a/bookwyrm/templates/user/groups.html +++ b/bookwyrm/templates/user/groups.html @@ -1,6 +1,11 @@ {% extends 'user/layout.html' %} +{% load utilities %} {% load i18n %} +{% block title %} +{% trans "Groups" %} - {{ user|username }} +{% endblock %} + {% block header %}
@@ -30,6 +35,10 @@
{% include 'groups/user_groups.html' with memberships=memberships %} + + {% if not memberships or not memberships.exists %} +

{% trans "No groups found." %}

+ {% endif %}
{% include 'snippets/pagination.html' with page=user.memberships path=path %} diff --git a/bookwyrm/templates/user/lists.html b/bookwyrm/templates/user/lists.html index aecd644a6..8a99d757e 100755 --- a/bookwyrm/templates/user/lists.html +++ b/bookwyrm/templates/user/lists.html @@ -1,6 +1,11 @@ {% extends 'user/layout.html' %} +{% load utilities %} {% load i18n %} +{% block title %} +{% trans "Lists" %} - {{ user|username }} +{% endblock %} + {% block header %}
diff --git a/bookwyrm/templates/user/reviews_comments.html b/bookwyrm/templates/user/reviews_comments.html index d85f8f512..22ae12fa7 100644 --- a/bookwyrm/templates/user/reviews_comments.html +++ b/bookwyrm/templates/user/reviews_comments.html @@ -2,7 +2,9 @@ {% load i18n %} {% load utilities %} -{% block title %}{{ user.display_name }}{% endblock %} +{% block title %} +{% trans "Reviews and Comments" %} - {{ user|username }} +{% endblock %} {% block header %}
@@ -21,7 +23,7 @@ {% endfor %} {% if not activities %}
-

{% trans "No reviews or comments yet!" %}

+

{% trans "No reviews or comments yet!" %}

{% endif %} diff --git a/bookwyrm/templates/user/user.html b/bookwyrm/templates/user/user.html index 0d015760c..135ace04f 100755 --- a/bookwyrm/templates/user/user.html +++ b/bookwyrm/templates/user/user.html @@ -126,7 +126,7 @@ {% endfor %} {% if not activities %}
-

{% trans "No activities yet!" %}

+

{% trans "No activities yet!" %}

{% endif %} From 27c40ccf20c6d10c0b258e5db716bc1a61399c69 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 6 Aug 2023 14:39:40 -0700 Subject: [PATCH 2/5] Uses comma formatting on user follower/following display values --- bookwyrm/templates/user/user_preview.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bookwyrm/templates/user/user_preview.html b/bookwyrm/templates/user/user_preview.html index 4ae4e117f..97dfe4109 100755 --- a/bookwyrm/templates/user/user_preview.html +++ b/bookwyrm/templates/user/user_preview.html @@ -23,12 +23,12 @@

{% if request.user.id == user.id or admin_mode %} - {% blocktrans trimmed count counter=user.followers.count %} - {{ counter }} follower + {% blocktrans trimmed count counter=user.followers.count with display_count=user.followers.count|intcomma %} + {{ display_count }} follower {% plural %} - {{ counter }} followers + {{ display_count }} followers {% endblocktrans %}, - {% blocktrans trimmed with counter=user.following.count %} + {% blocktrans trimmed with counter=user.following.count|intcomma %} {{ counter }} following {% endblocktrans %} From e8949bbffdd0063068a44e75e433e8128750b3bd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 6 Aug 2023 15:17:29 -0700 Subject: [PATCH 3/5] Make sure defaults are set on directory filters --- bookwyrm/templates/directory/community_filter.html | 4 ++-- bookwyrm/templates/directory/sort_filter.html | 4 ++-- bookwyrm/views/directory.py | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bookwyrm/templates/directory/community_filter.html b/bookwyrm/templates/directory/community_filter.html index 91783fd36..3d101fcee 100644 --- a/bookwyrm/templates/directory/community_filter.html +++ b/bookwyrm/templates/directory/community_filter.html @@ -4,11 +4,11 @@ {% block filter %} {% trans "Community" %} {% endblock %} diff --git a/bookwyrm/templates/directory/sort_filter.html b/bookwyrm/templates/directory/sort_filter.html index 344366016..5de7d6a10 100644 --- a/bookwyrm/templates/directory/sort_filter.html +++ b/bookwyrm/templates/directory/sort_filter.html @@ -6,8 +6,8 @@

diff --git a/bookwyrm/views/directory.py b/bookwyrm/views/directory.py index 81898af26..7b2ee78b5 100644 --- a/bookwyrm/views/directory.py +++ b/bookwyrm/views/directory.py @@ -19,7 +19,7 @@ class Directory(View): software = request.GET.get("software") if not software or software == "bookwyrm": filters["bookwyrm_user"] = True - scope = request.GET.get("scope") + scope = request.GET.get("scope", "federated") if scope == "local": filters["local"] = True @@ -38,6 +38,8 @@ class Directory(View): page.number, on_each_side=2, on_ends=1 ), "users": page, + "sort": sort, + "scope": scope, } return TemplateResponse(request, "directory/directory.html", data) From 185486c6fcae240ca279c366e65454176d9e5510 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 6 Aug 2023 19:35:50 -0700 Subject: [PATCH 4/5] Uses {% empty %} instead of if statements --- bookwyrm/templates/groups/user_groups.html | 2 ++ bookwyrm/templates/lists/list_items.html | 5 ++--- bookwyrm/templates/user/groups.html | 4 ---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bookwyrm/templates/groups/user_groups.html b/bookwyrm/templates/groups/user_groups.html index cc27ce42d..fb07e238a 100644 --- a/bookwyrm/templates/groups/user_groups.html +++ b/bookwyrm/templates/groups/user_groups.html @@ -31,5 +31,7 @@
+ {% empty %} +

{% trans "No groups found." %}

{% endfor %}
diff --git a/bookwyrm/templates/lists/list_items.html b/bookwyrm/templates/lists/list_items.html index 2c4ca1227..cff4c16c1 100644 --- a/bookwyrm/templates/lists/list_items.html +++ b/bookwyrm/templates/lists/list_items.html @@ -46,8 +46,7 @@
- {% endfor %} - {% if not lists or not lists.exists %} + {% empty %}

{% trans "No lists found." %}

- {% endif %} + {% endfor %} diff --git a/bookwyrm/templates/user/groups.html b/bookwyrm/templates/user/groups.html index 1e00bfe33..d3b48c849 100644 --- a/bookwyrm/templates/user/groups.html +++ b/bookwyrm/templates/user/groups.html @@ -35,10 +35,6 @@ {% include 'groups/user_groups.html' with memberships=memberships %} - - {% if not memberships or not memberships.exists %} -

{% trans "No groups found." %}

- {% endif %}
{% include 'snippets/pagination.html' with page=user.memberships path=path %} From 63b60ad62c56f6db3d0d38cf9c47ef8d0cd4182c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 6 Aug 2023 19:40:59 -0700 Subject: [PATCH 5/5] Removes "all books" link from profile when there are none --- bookwyrm/templates/user/user.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templates/user/user.html b/bookwyrm/templates/user/user.html index 135ace04f..05a2eeabc 100755 --- a/bookwyrm/templates/user/user.html +++ b/bookwyrm/templates/user/user.html @@ -51,9 +51,15 @@ {% endfor %}
+ {% empty %} +

+ No books found. +

{% endfor %} + {% if shelves.exists %} {% trans "View all books" %} + {% endif %} {% endif %} @@ -119,16 +125,16 @@ {% endif %} + {% for activity in activities %}
{% include 'snippets/status/status.html' with status=activity %}
- {% endfor %} - {% if not activities %} + {% empty %}

{% trans "No activities yet!" %}

- {% endif %} + {% endfor %} {% include 'snippets/pagination.html' with page=activities path=user.local_path anchor="#feed" mode="chronological" %}