forked from mirrors/bookwyrm
View bookmarked lists
This commit is contained in:
parent
42abc145c8
commit
a30094c822
4 changed files with 38 additions and 1 deletions
|
@ -27,6 +27,21 @@
|
||||||
{% include 'lists/create_form.html' with controls_text="create_list" %}
|
{% include 'lists/create_form.html' with controls_text="create_list" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<nav class="tabs">
|
||||||
|
<ul>
|
||||||
|
{% url 'lists' as url %}
|
||||||
|
<li{% if url in request.path %} class="is-active"{% endif %}>
|
||||||
|
<a href="{{ url }}">{% trans "All Lists" %}</a>
|
||||||
|
</li>
|
||||||
|
{% url 'bookmarked-lists' as url %}
|
||||||
|
<li{% if url in request.path %} class="is-active"{% endif %}>
|
||||||
|
<a href="{{ url }}">{% trans "Bookmarked Lists" %}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if lists %}
|
{% if lists %}
|
||||||
<section class="block">
|
<section class="block">
|
||||||
{% include 'lists/list_items.html' with lists=lists %}
|
{% include 'lists/list_items.html' with lists=lists %}
|
||||||
|
|
|
@ -218,6 +218,9 @@ urlpatterns = [
|
||||||
# lists
|
# lists
|
||||||
re_path(r"%s/lists/?$" % USER_PATH, views.UserLists.as_view(), name="user-lists"),
|
re_path(r"%s/lists/?$" % USER_PATH, views.UserLists.as_view(), name="user-lists"),
|
||||||
re_path(r"^list/?$", views.Lists.as_view(), name="lists"),
|
re_path(r"^list/?$", views.Lists.as_view(), name="lists"),
|
||||||
|
re_path(
|
||||||
|
r"^list/bookmarks/?$", views.BookmarkedLists.as_view(), name="bookmarked-lists"
|
||||||
|
),
|
||||||
re_path(r"^list/(?P<list_id>\d+)(.json)?/?$", views.List.as_view(), name="list"),
|
re_path(r"^list/(?P<list_id>\d+)(.json)?/?$", views.List.as_view(), name="list"),
|
||||||
re_path(r"^list/add-book/?$", views.list.add_book, name="list-add-book"),
|
re_path(r"^list/add-book/?$", views.list.add_book, name="list-add-book"),
|
||||||
re_path(
|
re_path(
|
||||||
|
|
|
@ -25,7 +25,7 @@ from .invite import ManageInvites, Invite, InviteRequest
|
||||||
from .invite import ManageInviteRequests, ignore_invite_request
|
from .invite import ManageInviteRequests, ignore_invite_request
|
||||||
from .isbn import Isbn
|
from .isbn import Isbn
|
||||||
from .landing import About, Home, Landing
|
from .landing import About, Home, Landing
|
||||||
from .list import Lists, List, Curate, UserLists
|
from .list import Lists, BookmarkedLists, List, Curate, UserLists
|
||||||
from .list import bookmark, unbookmark
|
from .list import bookmark, unbookmark
|
||||||
from .notifications import Notifications
|
from .notifications import Notifications
|
||||||
from .outbox import Outbox
|
from .outbox import Outbox
|
||||||
|
|
|
@ -63,6 +63,25 @@ class Lists(View):
|
||||||
return redirect(book_list.local_path)
|
return redirect(book_list.local_path)
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(login_required, name="dispatch")
|
||||||
|
class BookmarkedLists(View):
|
||||||
|
"""bookmarked book list page"""
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
"""display book lists"""
|
||||||
|
# hide lists with no approved books
|
||||||
|
lists = request.user.saved_lists.order_by("-updated_date")
|
||||||
|
|
||||||
|
paginated = Paginator(lists, 12)
|
||||||
|
data = {
|
||||||
|
"lists": paginated.get_page(request.GET.get("page")),
|
||||||
|
"list_form": forms.ListForm(),
|
||||||
|
"path": "/list",
|
||||||
|
}
|
||||||
|
return TemplateResponse(request, "lists/lists.html", data)
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(login_required, name="dispatch")
|
||||||
class UserLists(View):
|
class UserLists(View):
|
||||||
"""a user's book list page"""
|
"""a user's book list page"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue