1
0
Fork 0

Stores book identifiers with path part

This commit is contained in:
Mouse Reeve 2020-02-10 21:09:04 -08:00
parent b1ea495d17
commit 46e38366c7
8 changed files with 48 additions and 46 deletions

View file

@ -4,11 +4,7 @@
<div id="content">
<div>
<div class="book-preview">
<img class="book-cover" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<h1>{{ book.data.title }}</h1>
by {{ book.authors.first.data.name }}
{{ rating | stars }} {{ rating }}
<blockquote>{{ book.data.description | description }}</blockquote>
{% include 'book_snippet.html' with book=book size=large rating=rating description=True %}
</div>
</div>
<div class="reviews">

View file

@ -5,7 +5,7 @@
<h1>Search results</h1>
{% for result in results %}
<div>
<a href="/work/{{ result.olkey }}">{{ result.title }}</a> by {{ result.author }} ({{ result.year }})
<a href="/book/{{ result.olkey }}">{{ result.title }}</a> by {{ result.author }} ({{ result.year }})
</div>
{% endfor %}
</div>

View file

@ -0,0 +1,14 @@
{% load fr_display %}
<img class="book-cover {{ size }}" src="{% if book.cover %}/images/{{ book.cover }}{% else %}/static/images/no_cover.jpg{% endif %}">
<p class="title">
<a href="/book/{{ book.openlibrary_key }}">{{ book.data.title }}</a>
</p>
<p>by <a href="/author/{{ book.author.id }}" class="author">{{ book.authors.first.data.name }}</a></p>
{% if rating %}
{{ rating | stars }} {{ rating }}
{% endif %}
{% if description %}
<blockquote>{{ book.data.description | description }}</blockquote>
{% endif %}

View file

@ -9,9 +9,7 @@
<p>Start a book!</p>
{% for book in to_read.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>
{% include 'book_snippet.html' with book=book size="small" %}
<form name="shelve" action="/shelve/{{ user.localname }}_currently-reading/{{ book.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="book.id"></input>
@ -23,9 +21,7 @@
{% 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>
{% include 'book_snippet.html' with book=book size="small" %}
<form name="shelve" action="/shelve/{{ user.localname }}_read/{{ book.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="book.id"></input>
@ -39,13 +35,7 @@
<h2>Recently Added Books</h2>
{% for book in recent_books %}
<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>
by
{# TODO: there should be a helper function for listing authors #}
<a href="" class="author">{{ book.authors.first.data.name }}</a>
</p>
{% include 'book_snippet.html' with book=book size="small" %}
{% if not book in user_books.all %}
<form name="shelve" action="/shelve/{{ user.localname }}_to-read/{{ book.id }}" method="post">
{% csrf_token %}
@ -81,13 +71,7 @@
</h2>
{# TODO: wouldn't it rule if this was a reusable piece of markup? #}
<div class="book-preview">
<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
<a href="" class="author">{{ activity.book.authors.first.data.name }}</a>
<blockquote>{{ activity.book.data.description | description }}</blockquote>
</p>
{% include 'book_snippet.html' with book=activity.book size=large description=True %}
</div>
<div class="interaction"><button>⭐️ Like</button></div>
{% elif activity.fedireads_type == 'Review' %}
@ -95,12 +79,7 @@
reviewed {{ activity.book.data.title }}
</h2>
<div class="book-preview review">
<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
<a href="" class="author">{{ activity.book.authors.first.data.name }}</a>
</p>
{% include 'book_snippet.html' with book=activity.book size=large %}
<h3>{{ activity.name }}</h3>
<p>{{ activity.rating | stars }}</p>