From 8d17f888ea0e7c2c43180098cca629eff5016dc8 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 25 Sep 2021 11:36:35 +1000 Subject: [PATCH] improve naming of templates and urls for groups --- bookwyrm/templates/groups/group.html | 2 +- bookwyrm/templates/groups/members.html | 65 ++++++++++++++++++++++++++ bookwyrm/templates/groups/users.html | 41 ---------------- bookwyrm/urls.py | 2 +- 4 files changed, 67 insertions(+), 43 deletions(-) create mode 100644 bookwyrm/templates/groups/members.html delete mode 100644 bookwyrm/templates/groups/users.html diff --git a/bookwyrm/templates/groups/group.html b/bookwyrm/templates/groups/group.html index a73d7825..4fea5a84 100644 --- a/bookwyrm/templates/groups/group.html +++ b/bookwyrm/templates/groups/group.html @@ -8,7 +8,7 @@
- {% include "groups/users.html" %} + {% include "groups/members.html" %}

Lists

{% if not group.lists.exists %} diff --git a/bookwyrm/templates/groups/members.html b/bookwyrm/templates/groups/members.html new file mode 100644 index 00000000..b10cdd5f --- /dev/null +++ b/bookwyrm/templates/groups/members.html @@ -0,0 +1,65 @@ +{% load i18n %} +{% load utilities %} +{% load humanize %} + +{% if request.GET.updated %} +
+ {% trans "You successfully added a user to this group!" %} +
+{% endif %} + +

Group Members

+

{% trans "Members can add and remove books on your group's book lists" %}

+ +{% block panel %} +
+
+
+ +
+
+ +
+
+ {% include 'snippets/suggested_users.html' with suggested_users=suggested_users %} +
+{% endblock %} + +
    +{% for member in group.members.all %} +
    +
    + + {% include 'snippets/avatar.html' with user=user large=True %} + {{ user.display_name|truncatechars:10 }} + @{{ user|username|truncatechars:8 }} + + {% include 'snippets/add_to_group_button.html' with user=user minimal=True %} + {% if user.mutuals %} +

    + {% blocktrans trimmed with mutuals=user.mutuals|intcomma count counter=user.mutuals %} + {{ mutuals }} follower you follow + {% plural %} + {{ mutuals }} followers you follow{% endblocktrans %} +

    + {% elif user.shared_books %} +

    + {% blocktrans trimmed with shared_books=user.shared_books|intcomma count counter=user.shared_books %} + {{ shared_books }} book on your shelves + {% plural %} + {{ shared_books }} books on your shelves + {% endblocktrans %} +

    + {% elif request.user in user.following.all %} +

    + {% trans "Follows you" %} +

    + {% endif %} +
    +
    +{% endfor %} +
\ No newline at end of file diff --git a/bookwyrm/templates/groups/users.html b/bookwyrm/templates/groups/users.html deleted file mode 100644 index c7470b32..00000000 --- a/bookwyrm/templates/groups/users.html +++ /dev/null @@ -1,41 +0,0 @@ -{% load i18n %} - -{% if request.GET.updated %} -
- {% trans "You successfully added a user to this group!" %} -
-{% endif %} - -

Group Members

-

{% trans "Members can add and remove books on your group's book lists" %}

- -{% block panel %} -
-
-
- - {% if request.GET.query and no_results %} -

{% blocktrans with query=request.GET.query %}No users found for "{{ query }}"{% endblocktrans %}

- {% endif %} -
-
- -
-
- {% include 'snippets/suggested_users.html' with suggested_users=suggested_users %} -
-{% endblock %} - -
    -{% for member in group.members.all %} -
  • -
    - {% include 'directory/user_card.html' %} -
    -
  • -{% endfor %} -
\ No newline at end of file diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index cdf7493f..e688f813 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -255,7 +255,7 @@ urlpatterns = [ re_path(rf"{USER_PATH}/groups/?$", views.UserGroups.as_view(), name="user-groups"), re_path(r"^create-group/?$", views.create_group, name="create-group"), re_path(r"^group/(?P\d+)(.json)?/?$", views.Group.as_view(), name="group"), - re_path(r"^group/(?P\d+)/find-users/?$", views.FindAndAddUsers.as_view(), name="group-find-users"), + re_path(r"^group/(?P\d+)/add-users/?$", views.FindAndAddUsers.as_view(), name="group-find-users"), # lists re_path(rf"{USER_PATH}/lists/?$", views.UserLists.as_view(), name="user-lists"), re_path(r"^list/?$", views.Lists.as_view(), name="lists"),