Adds shelf page

Works on #25
This commit is contained in:
Mouse Reeve
2020-02-21 16:03:05 -08:00
parent 3eb91980e0
commit 6c629be667
8 changed files with 105 additions and 65 deletions

View File

@ -1,6 +1,4 @@
{% extends 'layout.html' %}
{% load humanize %}
{% load fr_display %}
{% block content %}
<div id="sidebar">
<div class="user-profile">
@ -59,60 +57,7 @@
{% for shelf in shelves %}
<div>
<h2>{{ shelf.name }}</h2>
{% if shelf.books %}
<table>
<tr class="book-preview">
<th>
Cover
</th>
<th>
Title
</th>
<th>
Author
</th>
<th>
Published
</th>
<th>
Shelved
</th>
<th>
External links
</th>
<th>
Rating
</th>
</tr>
{% for book in shelf.books.all %}
<tr class="book-preview">
<td>
{% include 'snippets/book_cover.html' with book=book %}
</td>
<td>
<a href="/book/{{ book.openlibrary_key }}">{{ book.data.title }}</a>
</td>
<td>
{{ book.authors.first.data.name }}
</td>
<td>
{{ book.data.first_publish_date }}
</td>
<td>
{{ book.added_date | naturalday }}
</td>
<td>
<a href="https://openlibrary.org{{ book.data.key }}" target="_blank">OpenLibrary</a>
</td>
<td>
{{ ratings | dict_key:book.id | stars}}
</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>This shelf is empty.</p>
{% endif %}
{% include 'snippets/shelf.html' with shelf=shelf ratings=ratings %}
</div>
{% endfor %}
</div>