mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Placeholder discover books page
This commit is contained in:
parent
c8a65ae6e1
commit
b1ad8ba317
4 changed files with 43 additions and 1 deletions
|
@ -178,6 +178,17 @@ ul.menu a {
|
|||
flex-grow: 0;
|
||||
width: max-content;
|
||||
}
|
||||
.row.wrap {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.book-grid .book-cover {
|
||||
height: 11em;
|
||||
width: auto;
|
||||
}
|
||||
.book-grid > * {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.follow-requests .row {
|
||||
margin-bottom: 0.5em;
|
||||
|
|
17
fedireads/templates/books.html
Normal file
17
fedireads/templates/books.html
Normal file
|
@ -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
|
||||
re_path(r'^login/?$', views.login_page),
|
||||
|
||||
# should return a ui view or activitypub json blob as requested
|
||||
path('', views.home),
|
||||
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
|
||||
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
|
||||
re_path(r'%s/?$' % 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)
|
||||
|
||||
|
||||
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):
|
||||
''' authentication '''
|
||||
# send user to the login page
|
||||
|
|
Loading…
Reference in a new issue