1
0
Fork 0
bookwyrm/bookwyrm/templates/book.html

191 lines
7.4 KiB
HTML
Raw Normal View History

2020-01-27 18:47:54 -08:00
{% extends 'layout.html' %}
2020-12-12 18:25:04 -08:00
{% load bookwyrm_tags %}
{% load humanize %}
2020-01-27 18:47:54 -08:00
{% block content %}
2020-09-29 11:00:54 -07:00
<div class="block">
2020-12-17 14:11:24 -08:00
<div class="columns">
<div class="column">
<h1 class="title">
{{ book.title }}{% if book.subtitle %}:
<small>{{ book.subtitle }}</small>{% endif %}
</h1>
{% if book.authors %}
<h2 class="subtitle">
by {% include 'snippets/authors.html' with book=book %}
</h2>
{% endif %}
</div>
2020-09-29 11:00:54 -07:00
2020-10-01 13:09:37 -07:00
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
2020-12-17 14:11:24 -08:00
<div class="column is-narrow">
2020-11-05 12:05:29 -08:00
<a href="{{ book.id }}/edit">
2020-09-29 20:36:43 -07:00
<span class="icon icon-pencil">
2020-09-30 15:10:37 -07:00
<span class="is-sr-only">Edit Book</span>
2020-09-29 20:36:43 -07:00
</span>
</a>
</div>
{% endif %}
2020-09-29 11:00:54 -07:00
</div>
<div class="columns">
2020-09-29 20:36:43 -07:00
<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 %}
2020-03-27 15:36:57 +00:00
{% include 'snippets/shelve_button.html' %}
2020-03-28 15:06:16 -07:00
{% if request.user.is_authenticated and not book.cover %}
2020-11-06 12:27:52 -08:00
<div class="box p-2">
2020-11-10 21:34:26 -08:00
<form name="add-cover" method="POST" action="/upload-cover/{{ book.id }}" enctype="multipart/form-data">
2020-11-06 12:27:52 -08:00
{% 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>
2020-03-28 15:06:16 -07:00
{% endif %}
2020-04-01 19:38:07 -07:00
2020-09-29 11:00:54 -07:00
<dl class="content">
{% for field in info_fields %}
2020-04-01 19:38:07 -07:00
{% if field.value %}
<dt>{{ field.name }}:</dt>
<dd>{{ field.value }}</dd>
{% endif %}
2020-09-29 11:00:54 -07:00
{% endfor %}
2020-04-01 19:38:07 -07:00
</dl>
2020-03-28 15:06:16 -07:00
</div>
2020-04-01 19:38:07 -07:00
2020-09-29 20:36:43 -07:00
<div class="column">
2020-09-29 11:00:54 -07:00
<div class="block">
2020-09-30 09:00:33 -07:00
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ reviews|length }} review{{ reviews|length|pluralize }})</h3>
2020-04-01 19:38:07 -07:00
2020-11-12 11:40:20 -08:00
{% include 'snippets/trimmed_text.html' with full=book|book_description %}
2020-04-01 19:38:07 -07:00
{% if request.user.is_authenticated and perms.bookwyrm.edit_book and not book|book_description %}
2020-11-28 07:55:31 -08:00
<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 %}
2020-12-08 09:43:12 -08:00
{% if book.parent_work.editions.count > 1 %}
<p><a href="/book/{{ book.parent_work.id }}/editions">{{ book.parent_work.editions.count }} editions</a></p>
2020-09-29 11:00:54 -07:00
{% endif %}
</div>
2020-04-01 19:38:07 -07:00
{# user's relationship to the book #}
<div>
{% for shelf in user_shelves %}
<p>
2020-12-19 18:54:56 -08:00
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 %}
2020-10-29 22:38:01 -07:00
{% for shelf in other_edition_shelves %}
<p>
2020-12-19 18:54:56 -08:00
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.
2020-12-11 16:57:38 -08:00
{% include 'snippets/switch_edition_button.html' with edition=book %}
</p>
{% endfor %}
2020-11-06 12:51:49 -08:00
{% for readthrough in readthroughs %}
{% include 'snippets/readthrough.html' with readthrough=readthrough %}
{% endfor %}
2020-11-06 12:51:49 -08:00
</div>
2020-10-29 12:32:37 -07:00
2020-04-04 13:12:15 -07:00
{% if request.user.is_authenticated %}
<div class="box">
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
2020-04-01 19:38:07 -07:00
</div>
2020-04-04 13:12:15 -07:00
2020-09-29 11:00:54 -07:00
<div class="block">
2020-04-04 13:12:15 -07:00
<form name="tag" action="/tag/" method="post">
<label for="tags" class="is-3">Tags</label>
2020-04-04 13:12:15 -07:00
{% csrf_token %}
2020-05-03 17:53:14 -07:00
<input type="hidden" name="book" value="{{ book.id }}">
<input id="tags" class="input" type="text" name="name">
2020-09-29 11:00:54 -07:00
<button class="button" type="submit">Add tag</button>
2020-04-04 13:12:15 -07:00
</form>
</div>
2020-09-29 11:00:54 -07:00
{% endif %}
<div class="block">
2020-09-29 14:11:55 -07:00
<div class="field is-grouped is-grouped-multiline">
2020-04-04 13:12:15 -07:00
{% for tag in tags %}
{% include 'snippets/tag.html' with book=book tag=tag user_tags=user_tags %}
{% endfor %}
2020-09-29 14:11:55 -07:00
</div>
2020-04-04 13:12:15 -07:00
</div>
2020-04-11 21:49:06 -07:00
</div>
</div>
2020-03-16 17:19:38 -07:00
</div>
2020-03-16 17:19:38 -07:00
{% if not reviews %}
2020-09-29 11:00:54 -07:00
<div class="block">
2020-03-16 17:19:38 -07:00
<p>No reviews yet!</p>
</div>
{% endif %}
<div class="block">
2020-09-29 13:11:52 -07:00
{% for review in reviews %}
<div class="block">
{% include 'snippets/status.html' with status=review hide_book=True depth=1 %}
</div>
{% endfor %}
<div class="block columns">
{% for rating in ratings %}
<div class="column">
<div class="media">
2020-12-30 15:21:14 -08:00
<div class="media-left">{% include 'snippets/avatar.html' with user=rating.user %}</div>
<div class="media-content">
<div>
2020-12-30 15:21:14 -08:00
{% 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>
2020-03-16 17:19:38 -07:00
</div>
2020-01-27 18:47:54 -08:00
{% endblock %}