add list cards to groups page

- add list cards to groups page based on lists page
- add sort to members on group page
This commit is contained in:
Hugh Rundle 2021-09-24 21:57:01 +10:00
parent 86a60d58e5
commit d4fcf88cf5
2 changed files with 38 additions and 4 deletions

View file

@ -34,10 +34,44 @@
<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 class="columns is-multiline">
{% for list in lists %}
<div class="column is-one-quarter">
<div class="card is-stretchable">
<header class="card-header">
<h4 class="card-header-title">
<a href="{{ list.local_path }}">{{ list.name }}</a> <span class="subtitle">{% include 'snippets/privacy-icons.html' with item=list %}</span>
</h4>
</header>
{% with list_books=list.listitem_set.all|slice:5 %}
{% if list_books %}
<div class="card-image columns is-mobile is-gapless is-clipped">
{% for book in list_books %}
<a class="column is-cover" href="{{ book.book.local_path }}">
{% include 'snippets/book_cover.html' with book=book.book cover_class='is-h-s' size='small' aria='show' %}
</a>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div class="card-content is-flex-grow-0">
<div class="is-clipped" {% if list.description %}title="{{ list.description }}"{% endif %}>
{% if list.description %}
{{ list.description|to_markdown|safe|truncatechars_html:30 }}
{% else %}
&nbsp;
{% endif %}
</div>
<p class="subtitle help">
{% include 'lists/created_text.html' with list=list %}
</p>
</div>
</div>
</div>
{% endfor %}
</div>
</li>
{% endfor %}
</ul>

View file

@ -48,7 +48,7 @@ class UserGroups(View):
def get(self, request, username):
"""display a group"""
user = get_user_from_username(request.user, username)
groups = models.Group.objects.filter(members=user)
groups = models.Group.objects.filter(members=user).order_by("-updated_date")
paginated = Paginator(groups, 12)
data = {