mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-19 06:36:35 +00:00
let's call it save not bookmark
This commit is contained in:
parent
b7fb55e6ad
commit
f267e53b56
6 changed files with 31 additions and 35 deletions
|
@ -3,32 +3,32 @@
|
||||||
|
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
|
|
||||||
{% with request.user|bookmarked:list as bookmarked %}
|
{% with request.user|saved:list as saved %}
|
||||||
<form
|
<form
|
||||||
name="bookmark-{{ list.id }}"
|
name="save-{{ list.id }}"
|
||||||
action="{% url 'list-bookmark' list.id %}"
|
action="{% url 'list-save' list.id %}"
|
||||||
method="POST"
|
method="POST"
|
||||||
class="interaction bookmark_{{ list.id }} {% if bookmarked %}is-hidden{% endif %}"
|
class="interaction save_{{ list.id }} {% if saved %}is-hidden{% endif %}"
|
||||||
data-id="bookmark_{{ list.id }}"
|
data-id="save_{{ list.id }}"
|
||||||
>
|
>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% trans "Bookmark" as text %}
|
{% trans "Save" as text %}
|
||||||
<button class="button">
|
<button class="button" type="submit">
|
||||||
<span class="icon icon-bookmark m-0-mobile" title="{{ text }}"></span>
|
<span class="icon icon-bookmark m-0-mobile" title="{{ text }}"></span>
|
||||||
<span class="is-sr-only-mobile">{{ text }}</span>
|
<span class="is-sr-only-mobile">{{ text }}</span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
name="bookmark-{{ list.id }}"
|
name="unsave-{{ list.id }}"
|
||||||
action="{% url 'list-unbookmark' list.id %}"
|
action="{% url 'list-unsave' list.id %}"
|
||||||
method="POST"
|
method="POST"
|
||||||
class="interaction active bookmark_{{ list.id }} {% if not bookmarked %}is-hidden{% endif %}"
|
class="interaction save_{{ list.id }} active {% if not saved %}is-hidden{% endif %}"
|
||||||
data-id="bookmark_{{ list.id }}"
|
data-id="save_{{ list.id }}"
|
||||||
>
|
>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% trans "Un-bookmark" as text %}
|
{% trans "Un-save" as text %}
|
||||||
<button class="button">
|
<button class="button" type="submit">
|
||||||
<span class="icon icon-bookmark m-0-mobile has-text-primary" title="{{ text }}"></span>
|
<span class="icon icon-bookmark m-0-mobile has-text-primary" title="{{ text }}"></span>
|
||||||
<span class="is-sr-only-mobile">{{ text }}</span>
|
<span class="is-sr-only-mobile">{{ text }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -31,12 +31,12 @@
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
{% url 'lists' as url %}
|
{% url 'lists' as url %}
|
||||||
<li{% if url in request.path %} class="is-active"{% endif %}>
|
<li{% if request.path in url %} class="is-active"{% endif %}>
|
||||||
<a href="{{ url }}">{% trans "All Lists" %}</a>
|
<a href="{{ url }}">{% trans "All Lists" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% url 'bookmarked-lists' as url %}
|
{% url 'saved-lists' as url %}
|
||||||
<li{% if url in request.path %} class="is-active"{% endif %}>
|
<li{% if url in request.path %} class="is-active"{% endif %}>
|
||||||
<a href="{{ url }}">{% trans "Bookmarked Lists" %}</a>
|
<a href="{{ url }}">{% trans "Saved Lists" %}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -18,7 +18,7 @@ def get_user_boosted(user, status):
|
||||||
return status.boosters.filter(user=user).exists()
|
return status.boosters.filter(user=user).exists()
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="bookmarked")
|
@register.filter(name="saved")
|
||||||
def get_user_bookmarked(user, book_list):
|
def get_user_saved_lists(user, book_list):
|
||||||
"""did the user bookmark a list"""
|
"""did the user save a list"""
|
||||||
return user.saved_lists.filter(id=book_list.id).exists()
|
return user.saved_lists.filter(id=book_list.id).exists()
|
||||||
|
|
|
@ -218,9 +218,7 @@ 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(
|
re_path(r"^list/saved/?$", views.SavedLists.as_view(), name="saved-lists"),
|
||||||
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(
|
||||||
|
@ -236,10 +234,8 @@ urlpatterns = [
|
||||||
re_path(
|
re_path(
|
||||||
r"^list/(?P<list_id>\d+)/curate/?$", views.Curate.as_view(), name="list-curate"
|
r"^list/(?P<list_id>\d+)/curate/?$", views.Curate.as_view(), name="list-curate"
|
||||||
),
|
),
|
||||||
re_path(r"bookmark/(?P<list_id>\d+)/?$", views.bookmark, name="list-bookmark"),
|
re_path(r"^save-list/(?P<list_id>\d+)/?$", views.saveList, name="list-save"),
|
||||||
re_path(
|
re_path(r"^unsave-list/(?P<list_id>\d+)/?$", views.unsaveList, name="list-unsave"),
|
||||||
r"^unbookmark/(?P<list_id>\d+)/?$", views.unbookmark, name="list-unbookmark"
|
|
||||||
),
|
|
||||||
# User books
|
# User books
|
||||||
re_path(r"%s/books/?$" % USER_PATH, views.Shelf.as_view(), name="user-shelves"),
|
re_path(r"%s/books/?$" % USER_PATH, views.Shelf.as_view(), name="user-shelves"),
|
||||||
re_path(
|
re_path(
|
||||||
|
|
|
@ -25,8 +25,8 @@ 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, BookmarkedLists, List, Curate, UserLists
|
from .list import Lists, SavedLists, List, Curate, UserLists
|
||||||
from .list import bookmark, unbookmark
|
from .list import saveList, unsaveList
|
||||||
from .notifications import Notifications
|
from .notifications import Notifications
|
||||||
from .outbox import Outbox
|
from .outbox import Outbox
|
||||||
from .reading import edit_readthrough, create_readthrough
|
from .reading import edit_readthrough, create_readthrough
|
||||||
|
|
|
@ -64,8 +64,8 @@ class Lists(View):
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(login_required, name="dispatch")
|
@method_decorator(login_required, name="dispatch")
|
||||||
class BookmarkedLists(View):
|
class SavedLists(View):
|
||||||
"""bookmarked book list page"""
|
"""saved book list page"""
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
"""display book lists"""
|
"""display book lists"""
|
||||||
|
@ -244,18 +244,18 @@ class Curate(View):
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
@login_required
|
@login_required
|
||||||
def bookmark(request, list_id):
|
def saveList(request, list_id):
|
||||||
"""bookmark a list"""
|
"""save a list"""
|
||||||
book_list = models.List.objects.get(id=list_id)
|
book_list = get_object_or_404(models.List, id=list_id)
|
||||||
request.user.saved_lists.add(book_list)
|
request.user.saved_lists.add(book_list)
|
||||||
return redirect("list", list_id)
|
return redirect("list", list_id)
|
||||||
|
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
@login_required
|
@login_required
|
||||||
def unbookmark(request, list_id):
|
def unsaveList(request, list_id):
|
||||||
"""unsave a list"""
|
"""unsave a list"""
|
||||||
book_list = models.List.objects.get(id=list_id)
|
book_list = get_object_or_404(models.List, id=list_id)
|
||||||
request.user.saved_lists.remove(book_list)
|
request.user.saved_lists.remove(book_list)
|
||||||
return redirect("list", list_id)
|
return redirect("list", list_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue