forked from mirrors/bookwyrm
237 lines
9.5 KiB
HTML
237 lines
9.5 KiB
HTML
{% extends 'layout.html' %}
|
|
{% load bookwyrm_tags %}
|
|
{% load humanize %}
|
|
{% block content %}
|
|
|
|
<div class="block">
|
|
<div class="columns">
|
|
<div class="column">
|
|
<h1 class="title">
|
|
{{ book.title }}{% if book.subtitle %}:
|
|
<small>{{ book.subtitle }}</small>{% endif %}
|
|
{% if book.series %}
|
|
<small class="has-text-grey-dark">({{ book.series }}{% if book.series_number %} #{{ book.series_number }}{% endif %})</small><br>
|
|
{% endif %}
|
|
</h1>
|
|
{% if book.authors %}
|
|
<h2 class="subtitle">
|
|
by {% include 'snippets/authors.html' with book=book %}
|
|
</h2>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
|
|
<div class="column is-narrow">
|
|
<a href="{{ book.id }}/edit">
|
|
<span class="icon icon-pencil">
|
|
<span class="is-sr-only">Edit Book</span>
|
|
</span>
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="columns">
|
|
<div class="column is-narrow">
|
|
{% include 'snippets/book_cover.html' with book=book size=large %}
|
|
{% include 'snippets/rate_action.html' with user=request.user book=book %}
|
|
{% include 'snippets/shelve_button.html' %}
|
|
|
|
{% if request.user.is_authenticated and not book.cover %}
|
|
<div class="box p-2">
|
|
<form name="add-cover" method="POST" action="/upload-cover/{{ book.id }}" enctype="multipart/form-data">
|
|
{% csrf_token %}
|
|
<div class="field">
|
|
<label class="label" for="id_cover">Cover:</label>
|
|
<input type="file" name="cover" accept="image/*" class="" id="id_cover">
|
|
</div>
|
|
<div class="field">
|
|
<button class="button is-small" type="submit">Add cover</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<section class="content">
|
|
<dl>
|
|
{% if book.isbn_13 %}
|
|
<div class="is-flex is-justify-content-space-between">
|
|
<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 %}
|
|
</section>
|
|
</div>
|
|
|
|
<div class="column">
|
|
<div class="block">
|
|
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ review_count }} review{{ reviews|length|pluralize }})</h3>
|
|
|
|
{% include 'snippets/trimmed_text.html' with full=book|book_description %}
|
|
|
|
{% if request.user.is_authenticated and perms.bookwyrm.edit_book and not book|book_description %}
|
|
<div>
|
|
<input class="toggle-control" type="radio" name="add-description" id="hide-description" checked>
|
|
<div class="toggle-content hidden">
|
|
<label class="button" for="add-description" tabindex="0" role="button">Add description</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<input class="toggle-control" type="radio" name="add-description" id="add-description">
|
|
<div class="toggle-content hidden">
|
|
<div class="box">
|
|
<form name="add-description" method="POST" action="/add-description/{{ book.id }}">
|
|
{% csrf_token %}
|
|
<p class="fields is-grouped">
|
|
<label class="label"for="id_description">Description:</label>
|
|
<textarea name="description" cols="None" rows="None" class="textarea" id="id_description"></textarea>
|
|
</p>
|
|
<div class="field">
|
|
<button class="button is-primary" type="submit">Save</button>
|
|
<label class="button" for="hide-description" tabindex="0" role="button">Cancel</label>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
{% if book.parent_work.editions.count > 1 %}
|
|
<p><a href="/book/{{ book.parent_work.id }}/editions">{{ book.parent_work.editions.count }} editions</a></p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{# user's relationship to the book #}
|
|
<div class="block">
|
|
{% for shelf in user_shelves %}
|
|
<p>
|
|
This edition is on your <a href="/user/{{ user.localname }}/shelf/{{ shelf.shelf.identifier }}">{{ shelf.shelf.name }}</a> shelf.
|
|
{% include 'snippets/shelf_selector.html' with current=shelf.shelf %}
|
|
</p>
|
|
{% endfor %}
|
|
{% for shelf in other_edition_shelves %}
|
|
<p>
|
|
A <a href="/book/{{ shelf.book.id }}">different edition</a> of this book is on your <a href="/user/{{ user.localname }}/shelf/{{ shelf.shelf.identifier }}">{{ shelf.shelf.name }}</a> shelf.
|
|
{% include 'snippets/switch_edition_button.html' with edition=book %}
|
|
</p>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if readthroughs.exists %}
|
|
<div>
|
|
<h2 class="title is-5">Your reading activity</h2>
|
|
{% for readthrough in readthroughs %}
|
|
{% include 'snippets/readthrough.html' with readthrough=readthrough %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if request.user.is_authenticated %}
|
|
<div class="box">
|
|
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
|
|
</div>
|
|
|
|
<div class="block">
|
|
<form name="tag" action="/tag/" method="post">
|
|
<label for="tags" class="is-3">Tags</label>
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
<input id="tags" class="input" type="text" name="name">
|
|
<button class="button" type="submit">Add tag</button>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="block">
|
|
<div class="field is-grouped is-grouped-multiline">
|
|
{% for tag in tags %}
|
|
{% include 'snippets/tag.html' with book=book tag=tag user_tags=user_tags %}
|
|
{% endfor %}
|
|
</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 class="block">
|
|
{% for review in reviews %}
|
|
<div class="block">
|
|
{% include 'snippets/status.html' with status=review hide_book=True depth=1 %}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<div class="block is-flex is-flex-wrap-wrap">
|
|
{% for rating in ratings %}
|
|
<div class="block mr-5">
|
|
<div class="media">
|
|
<div class="media-left">{% include 'snippets/avatar.html' with user=rating.user %}</div>
|
|
<div class="media-content">
|
|
<div>
|
|
{% include 'snippets/username.html' with user=rating.user %}
|
|
</div>
|
|
<div class="field is-grouped mb-0">
|
|
<div>rated it</div>
|
|
{% include 'snippets/stars.html' with rating=rating.rating %}
|
|
</div>
|
|
<div>
|
|
<a href="{{ rating.remote_id }}">{{ rating.published_date | naturaltime }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|