This commit is contained in:
Mouse Reeve
2020-01-29 00:05:58 -08:00
parent 789b9a1dc0
commit f3330ab6e7
9 changed files with 58 additions and 24 deletions

View File

@ -4,18 +4,24 @@
<div>
<h2>Currently Reading</h2>
{# listing books currently on user's shelves #}
{% if not shelves.first.books.all %}
{% if not reading.books.all %}
<p>Start a book!</p>
{% endif %}
{% for book in shelves.first.books.all %}
{% for book in to_read.books.all %}
<div class="book-preview">
<img class="cover" src="static/images/small.jpg">
<img class="book-cover small" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title"><a href="{{ book.openlibrary_key }}">{{ book.data.title }}</a></p>
<p>by <a href="" class="author">{{ book.authors.first.data.name }}</a></p>
<button>start reading</button>
</div>
{% endfor %}
{% endif %}
{% for book in reading.books.all %}
<div class="book-preview">
<img class="book-cover small" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title"><a href="{{ book.openlibrary_key }}">{{ book.data.title }}</a></p>
<p>by <a href="" class="author">{{ book.authors.first.data.name }}</a></p>
{% if shelf.type == 'reading' %}
{# TODO: re-shelve a book #}
<button>done reading</button>
{% endif %}
</div>
{% endfor %}
</div>
@ -24,7 +30,7 @@
<h2>Recently Added Books</h2>
{% for book in recent_books %}
<div class="book-preview">
<img class="cover" src="static/images/small.jpg">
<img class="book-cover small" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="{{ book.openlibrary_key }}">{{ book.data.title }}</a>
by
@ -65,7 +71,7 @@
</h2>
{# TODO: wouldn't it rule if this was a reusable piece of markup? #}
<div class="book-preview">
<img class="cover" src="static/images/med.jpg">
<img class="book-cover" src="{% if activity.book.cover %}/images/{{ activity.book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="{{ activity.book.openlibrary_key }}">{{ activity.book.data.title }}</a>
by
@ -77,7 +83,7 @@
reviewed {{ activity.book.data.title }}
</h2>
<div class="book-preview review">
<img class="cover" src="static/images/med.jpg">
<img class="book-cover" src="{% if activity.book.cover %}/images/{{ activity.book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="{{ activity.book.openlibrary_key }}">{{ activity.book.data.title }}</a>
by