forked from mirrors/bookwyrm
add user cards to group pages
This commit is contained in:
parent
264d9b2f3c
commit
86a60d58e5
2 changed files with 23 additions and 19 deletions
|
@ -13,19 +13,34 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not members.object_list.exists %}
|
||||
{% if not group.members.exists %}
|
||||
<p>{% trans "This group has no members" %}</p>
|
||||
{% else %}
|
||||
<ol start="{{ members.start_index }}" class="ordered-list">
|
||||
{% for member in members %}
|
||||
<h2 class="heading">Group Members</h2>
|
||||
<ul start="{{ members.start_index }}" class="ordered-list">
|
||||
{% for member in group.members.all %}
|
||||
<li class="block mb-5">
|
||||
<div class="card">
|
||||
<p>member.username</p>
|
||||
</div>
|
||||
<div class="column is-one-third">
|
||||
{% include 'directory/user_card.html' %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if not group.lists.exists %}
|
||||
<p>{% trans "This group has no lists" %}</p>
|
||||
{% else %}
|
||||
<h2 class="heading">Lists</h2>
|
||||
<ul start="{{ lists.start_index }}" class="ordered-list">
|
||||
{% for list in group.lists.all %}
|
||||
<li class="block mb-5">
|
||||
<!-- TODO: make these proper list cards -->
|
||||
<div class="card">
|
||||
<a href={{ member.local_path }}>{{ list.name }}</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% include "snippets/pagination.html" with page=items %}
|
||||
</section>
|
||||
|
|
|
@ -41,17 +41,6 @@ class Group(View):
|
|||
}
|
||||
return TemplateResponse(request, "groups/group.html", data)
|
||||
|
||||
# @method_decorator(login_required, name="dispatch")
|
||||
# # pylint: disable=unused-argument
|
||||
# def post(self, request):
|
||||
# """create a book_list"""
|
||||
# form = forms.ListForm(request.POST)
|
||||
# if not form.is_valid():
|
||||
# return redirect("lists")
|
||||
# book_list = form.save()
|
||||
|
||||
# return redirect(book_list.local_path)
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class UserGroups(View):
|
||||
"""a user's groups page"""
|
||||
|
@ -59,9 +48,7 @@ class UserGroups(View):
|
|||
def get(self, request, username):
|
||||
"""display a group"""
|
||||
user = get_user_from_username(request.user, username)
|
||||
# groups = models.GroupMember.objects.filter(user=user)
|
||||
groups = models.Group.objects.filter(members=user)
|
||||
# groups = privacy_filter(request.user, groups)
|
||||
paginated = Paginator(groups, 12)
|
||||
|
||||
data = {
|
||||
|
@ -83,4 +70,6 @@ def create_group(request):
|
|||
return redirect(request.headers.get("Referer", "/"))
|
||||
|
||||
group = form.save()
|
||||
# TODO: add user as group member
|
||||
models.GroupMember.objects.create(group=group, user=request.user)
|
||||
return redirect(group.local_path)
|
Loading…
Reference in a new issue