moviewyrm/bookwyrm/templates/snippets/shelf.html

74 lines
2.1 KiB
HTML
Raw Normal View History

2020-02-22 00:03:05 +00:00
{% load humanize %}
2021-02-28 02:48:10 +00:00
{% load i18n %}
2020-12-13 02:25:04 +00:00
{% load bookwyrm_tags %}
2020-12-31 00:07:29 +00:00
{% if books|length > 0 %}
<div class="scroll-x">
2020-09-29 21:11:55 +00:00
<table class="table is-striped is-fullwidth">
2020-02-22 00:03:05 +00:00
<tr class="book-preview">
2021-02-28 02:48:10 +00:00
<th>{% trans "Cover" %}</th>
<th>{% trans "Title" %}</th>
<th>{% trans "Author" %}</th>
<th>{% trans "Published" %}</th>
<th>{% trans "Shelved" %}</th>
<th>{% trans "Started" %}</th>
<th>{% trans "Finished" %}</th>
<th>{% trans "External links" %}</th>{% if ratings %}
<th>{% trans "Rating" %}</th>{% endif %}
2020-02-22 00:03:05 +00:00
</tr>
2020-12-31 00:07:29 +00:00
{% for book in books %}
2020-02-22 00:03:05 +00:00
<tr class="book-preview">
<td>
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book size="small" %}</a>
2020-02-22 00:03:05 +00:00
</td>
<td>
<a href="{{ book.local_path }}">{{ book.title }}</a>
2020-02-22 00:03:05 +00:00
</td>
<td>
{{ book.authors.first.name }}
2020-02-22 00:03:05 +00:00
</td>
<td>
2020-03-10 00:55:15 +00:00
{% if book.first_published_date %}{{ book.first_published_date }}{% endif %}
2020-02-22 00:03:05 +00:00
</td>
<td>
2020-03-10 00:55:15 +00:00
{{ book.created_date | naturalday }}
2020-02-22 00:03:05 +00:00
</td>
{% latest_read_through book user as read_through %}
<td>
{{ read_through.start_date | naturalday |default_if_none:""}}
</td>
<td>
{{ read_through.finish_date | naturalday |default_if_none:""}}
</td>
2020-02-22 00:03:05 +00:00
<td>
2021-02-28 02:48:10 +00:00
<a href="https://openlibrary.org/book/{{ book.openlibrary_key }}" target="_blank">{% trans "OpenLibrary" %}</a>
2020-02-22 00:03:05 +00:00
</td>
{% if ratings %}
<td>
{% include 'snippets/stars.html' with rating=ratings|dict_key:book.id %}
2020-02-22 00:03:05 +00:00
</td>
{% endif %}
{% if shelf.user == request.user %}
2020-10-28 23:52:23 +00:00
<td>
{% include 'snippets/shelf_selector.html' with current=shelf %}
2020-10-28 23:52:23 +00:00
</td>
{% endif %}
2020-02-22 00:03:05 +00:00
</tr>
{% endfor %}
</table>
2021-02-23 21:04:24 +00:00
</div>
2020-02-22 00:03:05 +00:00
{% else %}
2021-02-28 02:48:10 +00:00
<p>{% trans "This shelf is empty." %}</p>
2020-11-11 04:33:46 +00:00
{% if shelf.editable %}
<form name="delete-shelf" action="/delete-shelf/{{ shelf.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="user" value="{{ request.user.id }}">
<button class="button is-danger is-light" type="submit">
2021-02-28 02:48:10 +00:00
{% trans "Delete shelf" %}
2020-11-11 04:33:46 +00:00
</button>
</form>
{% endif %}
2020-02-22 00:03:05 +00:00
{% endif %}