Re-organizes metadata on book page

This commit is contained in:
Mouse Reeve 2021-01-04 17:42:02 -08:00
parent 89e2e75c0b
commit 1046aa7ad2
2 changed files with 58 additions and 20 deletions

View file

@ -9,15 +9,13 @@
<h1 class="title"> <h1 class="title">
{{ book.title }}{% if book.subtitle %}: {{ book.title }}{% if book.subtitle %}:
<small>{{ book.subtitle }}</small>{% endif %} <small>{{ book.subtitle }}</small>{% endif %}
</h1>
{% if book.series or book.author %}
<h2 class="subtitle">
{% if book.series %} {% if book.series %}
<small class="has-text-grey-dark">({{ book.series }}{% if book.series_number %} #{{ book.series_number }}{% endif %})</small><br> <small class="has-text-grey-dark">({{ book.series }}{% if book.series_number %} #{{ book.series_number }}{% endif %})</small><br>
{% endif %} {% endif %}
{% if book.authors %} </h1>
{% if book.authors %}
<h2 class="subtitle">
by {% include 'snippets/authors.html' with book=book %} by {% include 'snippets/authors.html' with book=book %}
{% endif %}
</h2> </h2>
{% endif %} {% endif %}
</div> </div>
@ -54,14 +52,39 @@
</div> </div>
{% endif %} {% endif %}
<dl class="content"> <section class="content">
{% for field in info_fields %} <dl>
{% if field.value %} {% if book.isbn_13 %}
<dt>{{ field.name }}:</dt> <div class="is-flex is-justify-content-space-between">
<dd>{{ field.value }}</dd> <dt>ISBN:</dt>
<dd>{{ book.isbn_13 }}</dd>
</div>
{% endif %}
{% if book.oclc_number %}
<div class="is-flex is-justify-content-space-between">
<dt>OCLC Number:</dt>
<dd>{{ book.oclc_number }}</dd>
</div>
{% endif %}
{% if book.asin %}
<div class="is-flex is-justify-content-space-between">
<dt>ASIN:</dt>
<dd>{{ book.asin }}</dd>
</div>
{% endif %}
</dl>
<p>
{% if book.physical_format %}{{ book.physical_format | title }}{% if book.pages %},<br>{% endif %}{% endif %}
{% if book.pages %}{{ book.pages }} pages{% endif %}
</p>
{% if book.openlibrary_key %}
<p><a href="https://openlibrary.org/books/{{ book.openlibrary_key }}" target="_blank" rel="noopener">View on OpenLibrary</a></p>
{% endif %} {% endif %}
{% endfor %} </section>
</dl>
</div> </div>
<div class="column"> <div class="column">
@ -150,6 +173,29 @@
</div> </div>
</div> </div>
<div class="column is-narrow">
{% if book.subjects %}
<section class="content block">
<h2 class="title is-5">Subjects</h2>
<ul>
{% for subject in book.subjects %}
<li>{{ subject }}</li>
{% endfor %}
</ul>
</section>
{% endif %}
{% if book.subject_places %}
<section class="content block">
<h2 class="title is-5">Places</h2>
<ul>
{% for place in book.subject_placess %}
<li>{{ place }}</li>
{% endfor %}
</ul>
</section>
{% endif %}
</div>
</div> </div>
</div> </div>

View file

@ -676,14 +676,6 @@ def book_page(request, book_id):
'other_edition_shelves': other_edition_shelves, 'other_edition_shelves': other_edition_shelves,
'readthroughs': readthroughs, 'readthroughs': readthroughs,
'path': '/book/%s' % book_id, 'path': '/book/%s' % book_id,
'info_fields': [
{'name': 'ISBN', 'value': book.isbn_13},
{'name': 'OCLC number', 'value': book.oclc_number},
{'name': 'OpenLibrary ID', 'value': book.openlibrary_key},
{'name': 'Goodreads ID', 'value': book.goodreads_key},
{'name': 'Format', 'value': book.physical_format},
{'name': 'Pages', 'value': book.pages},
],
'next': next_page, 'next': next_page,
'prev': prev_page, 'prev': prev_page,
} }