mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-10 17:25:35 +00:00
Backwards compatibility with "shelf" urls
This commit is contained in:
parent
4a490d25a8
commit
f8ce9b0956
4 changed files with 6 additions and 5 deletions
|
@ -49,7 +49,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
|||
def get_remote_id(self):
|
||||
""" shelf identifier instead of id """
|
||||
base_path = self.user.remote_id
|
||||
return "%s/shelf/%s" % (base_path, self.identifier)
|
||||
return "%s/books/%s" % (base_path, self.identifier)
|
||||
|
||||
class Meta:
|
||||
""" user/shelf unqiueness """
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<ul>
|
||||
{% for shelf_tab in shelves %}
|
||||
<li class="{% if shelf_tab.identifier == shelf.identifier %}is-active{% endif %}">
|
||||
<a href="/user/{{ user | username }}/shelf/{{ shelf_tab.identifier }}"{% if shelf_tab.identifier == shelf.identifier %} aria-current="page"{% endif %}>{% if shelf_tab.identifier == 'to-read' %}{% trans "To Read" %}{% elif shelf_tab.identifier == 'reading' %}{% trans "Currently Reading" %}{% elif shelf_tab.identifier == 'read' %}{% trans "Read" %}{% else %}{{ shelf_tab.name }}{% endif %}</a>
|
||||
<a href="{{ shelf_tab.local_path }}"{% if shelf_tab.identifier == shelf.identifier %} aria-current="page"{% endif %}>{% if shelf_tab.identifier == 'to-read' %}{% trans "To Read" %}{% elif shelf_tab.identifier == 'reading' %}{% trans "Currently Reading" %}{% elif shelf_tab.identifier == 'read' %}{% trans "Read" %}{% else %}{{ shelf_tab.name }}{% endif %}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
{% with user|username as username %}
|
||||
{% if 'user/'|add:username|add:'/books' not in request.path %}
|
||||
{% if 'user/'|add:username|add:'/books' not in request.path and 'user/'|add:username|add:'/shelf' not in request.path %}
|
||||
<nav class="tabs">
|
||||
<ul>
|
||||
{% url 'user-feed' user|username as url %}
|
||||
|
|
|
@ -154,13 +154,14 @@ urlpatterns = [
|
|||
# shelf
|
||||
re_path(r"%s/books/?$" % user_path, views.user_shelves_page, name="user-shelves"),
|
||||
re_path(
|
||||
r"^%s/books/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % user_path,
|
||||
r"^%s/(helf|books)/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % user_path,
|
||||
views.Shelf.as_view(),
|
||||
name="shelf",
|
||||
),
|
||||
re_path(
|
||||
r"^%s/books/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % local_user_path,
|
||||
r"^%s/(books|shelf)/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % local_user_path,
|
||||
views.Shelf.as_view(),
|
||||
name="shelf"
|
||||
),
|
||||
re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"),
|
||||
re_path(r"^delete-shelf/(?P<shelf_id>\d+)?$", views.delete_shelf),
|
||||
|
|
Loading…
Reference in a new issue