mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-01 22:11:16 +00:00
Merges display of lists to show all
Rather than separating out "your lists"
This commit is contained in:
parent
d021666f2b
commit
9b949d9845
3 changed files with 21 additions and 29 deletions
|
@ -14,7 +14,13 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-content is-flex-grow-0">
|
<div class="card-content is-flex-grow-0">
|
||||||
{% if list.description %}{{ list.description | to_markdown | safe | truncatewords_html:20 }}{% endif %}
|
<div {% if list.description %}title="{{ list.description }}"{% endif %}>
|
||||||
|
{% if list.description %}
|
||||||
|
{{ list.description|to_markdown|safe|truncatechars_html:30 }}
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
<p class="subtitle help">
|
<p class="subtitle help">
|
||||||
{% include 'lists/created_text.html' with list=list %}
|
{% include 'lists/created_text.html' with list=list %}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
|
{% load bookwyrm_tags %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Lists" %}{% endblock %}
|
{% block title %}{% trans "Lists" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<header class="block">
|
|
||||||
<h1 class="title">{% trans "Lists" %}</h1>
|
|
||||||
</header>
|
|
||||||
{% if request.user.is_authenticated and not lists.has_previous %}
|
|
||||||
<header class="block columns is-mobile">
|
<header class="block columns is-mobile">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h2 class="title">{% trans "Your lists" %}</h2>
|
<h1 class="title">
|
||||||
|
{% trans "Lists" %}
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<a class="help has-text-weight-normal" href="{% url 'user-lists' request.user|username %}">Your lists</a>
|
||||||
|
{% endif %}
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
{% trans "Create List" as button_text %}
|
{% trans "Create List" as button_text %}
|
||||||
|
@ -23,23 +25,11 @@
|
||||||
{% include 'lists/create_form.html' with controls_text="create-list" %}
|
{% include 'lists/create_form.html' with controls_text="create-list" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="block content">
|
|
||||||
{% if request.user.list_set.exists %}
|
|
||||||
{% include 'lists/list_items.html' with lists=request.user.list_set.all|slice:4 %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if request.user.list_set.count > 4 %}
|
|
||||||
<a href="{% url 'user-lists' request.user.localname %}">{% blocktrans with size=request.user.list_set.count %}See all {{ size }} lists{% endblocktrans %}</a>
|
|
||||||
{% endif %}
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{% if lists %}
|
{% if lists %}
|
||||||
<section class="block content">
|
<section class="block content">
|
||||||
<h2 class="title">{% trans "Recent Lists" %}</h2>
|
|
||||||
{% include 'lists/list_items.html' with lists=lists %}
|
{% include 'lists/list_items.html' with lists=lists %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{% include 'snippets/pagination.html' with page=lists path=path %}
|
{% include 'snippets/pagination.html' with page=lists path=path %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,17 +27,13 @@ class Lists(View):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
page = 1
|
page = 1
|
||||||
|
|
||||||
user = request.user if request.user.is_authenticated else None
|
|
||||||
# hide lists with no approved books
|
# hide lists with no approved books
|
||||||
lists = (
|
lists = models.List.objects.annotate(
|
||||||
models.List.objects.filter(
|
item_count=Count("listitem", filter=Q(listitem__approved=True))
|
||||||
~Q(user=user),
|
).filter(
|
||||||
)
|
item_count__gt=0
|
||||||
.annotate(item_count=Count("listitem", filter=Q(listitem__approved=True)))
|
).distinct().all()
|
||||||
.filter(item_count__gt=0)
|
|
||||||
.distinct()
|
|
||||||
.all()
|
|
||||||
)
|
|
||||||
lists = privacy_filter(
|
lists = privacy_filter(
|
||||||
request.user, lists, privacy_levels=["public", "followers"]
|
request.user, lists, privacy_levels=["public", "followers"]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue