forked from mirrors/bookwyrm
User shelves page
This commit is contained in:
parent
e1c598b7cf
commit
ff1099d23e
6 changed files with 32 additions and 5 deletions
|
@ -483,7 +483,7 @@ tr {
|
||||||
}
|
}
|
||||||
|
|
||||||
tr:nth-child(even) {
|
tr:nth-child(even) {
|
||||||
background-color: #DDD;
|
background-color: #EEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<div id="branding"><a href="/"><img id="logo" src="/static/images/logo-small.png" alt="BookWyrm"></img></a></div>
|
<div id="branding"><a href="/"><img id="logo" src="/static/images/logo-small.png" alt="BookWyrm"></img></a></div>
|
||||||
|
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
<li><a href="/user/{{request.user.localname}}">Your shelves</a></li>
|
<li><a href="/user/{{request.user.localname}}/shelves">Your shelves</a></li>
|
||||||
<li><a href="/#feed">Updates</a></li>
|
<li><a href="/#feed">Updates</a></li>
|
||||||
<li><a href="/books">Discover Books</a></li>
|
<li><a href="/books">Discover Books</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{% for book in shelf.books.all %}
|
{% for book in shelf.books.all %}
|
||||||
<tr class="book-preview">
|
<tr class="book-preview">
|
||||||
<td>
|
<td>
|
||||||
{% include 'snippets/book_cover.html' with book=book %}
|
{% include 'snippets/book_cover.html' with book=book size="small" %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/book/{{ book.openlibrary_key }}">{{ book.title }}</a>
|
<a href="/book/{{ book.openlibrary_key }}">{{ book.title }}</a>
|
||||||
|
|
14
fedireads/templates/user_shelves.html
Normal file
14
fedireads/templates/user_shelves.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{% extends 'layout.html' %}
|
||||||
|
{% load fr_display %}
|
||||||
|
{% block content %}
|
||||||
|
{% include 'user_header.html' with user=user %}
|
||||||
|
|
||||||
|
{% for shelf in shelves %}
|
||||||
|
<div class="content-container">
|
||||||
|
<h2>{{ shelf.name }}</h2>
|
||||||
|
{% include 'snippets/shelf.html' with shelf=shelf ratings=ratings %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -39,6 +39,7 @@ urlpatterns = [
|
||||||
re_path(r'%s/?$' % user_path, views.user_page),
|
re_path(r'%s/?$' % user_path, views.user_page),
|
||||||
re_path(r'%s\.json$' % local_user_path, views.user_page),
|
re_path(r'%s\.json$' % local_user_path, views.user_page),
|
||||||
re_path(r'user-edit/?$', views.edit_profile_page),
|
re_path(r'user-edit/?$', views.edit_profile_page),
|
||||||
|
re_path(r'%s/shelves/?$' % local_user_path, views.user_shelves_page),
|
||||||
re_path(r'%s/followers/?$' % local_user_path, views.followers_page),
|
re_path(r'%s/followers/?$' % local_user_path, views.followers_page),
|
||||||
re_path(r'%s/followers.json$' % local_user_path, views.followers_page),
|
re_path(r'%s/followers.json$' % local_user_path, views.followers_page),
|
||||||
re_path(r'%s/following/?$' % local_user_path, views.following_page),
|
re_path(r'%s/following/?$' % local_user_path, views.following_page),
|
||||||
|
|
|
@ -132,11 +132,9 @@ def user_page(request, username, subpage=None):
|
||||||
# otherwise we're at a UI view
|
# otherwise we're at a UI view
|
||||||
|
|
||||||
# TODO: change display with privacy and authentication considerations
|
# TODO: change display with privacy and authentication considerations
|
||||||
shelves = get_user_shelf_preview(user)
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'user': user,
|
'user': user,
|
||||||
'shelves': shelves,
|
|
||||||
'is_self': request.user.id == user.id,
|
'is_self': request.user.id == user.id,
|
||||||
}
|
}
|
||||||
if subpage == 'followers':
|
if subpage == 'followers':
|
||||||
|
@ -145,7 +143,12 @@ def user_page(request, username, subpage=None):
|
||||||
elif subpage == 'following':
|
elif subpage == 'following':
|
||||||
data['following'] = user.following.all()
|
data['following'] = user.following.all()
|
||||||
return TemplateResponse(request, 'following.html', data)
|
return TemplateResponse(request, 'following.html', data)
|
||||||
|
elif subpage == 'shelves':
|
||||||
|
data['shelves'] = user.shelf_set.all()
|
||||||
|
return TemplateResponse(request, 'user_shelves.html', data)
|
||||||
else:
|
else:
|
||||||
|
shelves = get_user_shelf_preview(user)
|
||||||
|
data['shelves'] = shelves
|
||||||
activities = models.Status.objects.filter(
|
activities = models.Status.objects.filter(
|
||||||
user=user,
|
user=user,
|
||||||
).order_by(
|
).order_by(
|
||||||
|
@ -195,6 +198,15 @@ def following_page(request, username):
|
||||||
return user_page(request, username, subpage='following')
|
return user_page(request, username, subpage='following')
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
def user_shelves_page(request, username):
|
||||||
|
''' list of followers '''
|
||||||
|
if request.method != 'GET':
|
||||||
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
|
return user_page(request, username, subpage='shelves')
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def status_page(request, username, status_id):
|
def status_page(request, username, status_id):
|
||||||
''' display a particular status (and replies, etc) '''
|
''' display a particular status (and replies, etc) '''
|
||||||
|
|
Loading…
Reference in a new issue