Placeholder discover books page
This commit is contained in:
parent
c8a65ae6e1
commit
b1ad8ba317
|
@ -178,6 +178,17 @@ ul.menu a {
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
width: max-content;
|
width: max-content;
|
||||||
}
|
}
|
||||||
|
.row.wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book-grid .book-cover {
|
||||||
|
height: 11em;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.book-grid > * {
|
||||||
|
margin-bottom: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
.follow-requests .row {
|
.follow-requests .row {
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
{% extends 'layout.html' %}
|
||||||
|
{% load fr_display %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="content-container">
|
||||||
|
<h2>Recently Added Books</h2>
|
||||||
|
<div class="book-grid row wrap">
|
||||||
|
{% for book in books %}
|
||||||
|
<div class="book-preview">
|
||||||
|
<a href="{{ book.absolute_id }}">
|
||||||
|
{% include 'snippets/book_cover.html' with book=book %}
|
||||||
|
</a>
|
||||||
|
{% include 'snippets/shelve_button.html' with book=book %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -30,11 +30,12 @@ urlpatterns = [
|
||||||
# ui views
|
# ui views
|
||||||
re_path(r'^login/?$', views.login_page),
|
re_path(r'^login/?$', views.login_page),
|
||||||
|
|
||||||
# should return a ui view or activitypub json blob as requested
|
|
||||||
path('', views.home),
|
path('', views.home),
|
||||||
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
|
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
|
||||||
re_path(r'^notifications/?', views.notifications_page),
|
re_path(r'^notifications/?', views.notifications_page),
|
||||||
|
re_path(r'books/?$', views.books_page),
|
||||||
|
|
||||||
|
# should return a ui view or activitypub json blob as requested
|
||||||
# users
|
# users
|
||||||
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),
|
||||||
|
|
|
@ -95,6 +95,19 @@ def home_tab(request, tab):
|
||||||
return TemplateResponse(request, 'feed.html', data)
|
return TemplateResponse(request, 'feed.html', data)
|
||||||
|
|
||||||
|
|
||||||
|
def books_page(request):
|
||||||
|
''' discover books '''
|
||||||
|
recent_books = models.Book.objects.filter(
|
||||||
|
~Q(shelfbook__shelf__user=request.user)
|
||||||
|
).order_by(
|
||||||
|
'-created_date'
|
||||||
|
)[:50]
|
||||||
|
data = {
|
||||||
|
'books': recent_books,
|
||||||
|
}
|
||||||
|
return TemplateResponse(request, 'books.html', data)
|
||||||
|
|
||||||
|
|
||||||
def login_page(request):
|
def login_page(request):
|
||||||
''' authentication '''
|
''' authentication '''
|
||||||
# send user to the login page
|
# send user to the login page
|
||||||
|
|
Loading…
Reference in New Issue