moviewyrm/bookwyrm/templates/book.html
2020-09-30 09:00:33 -07:00

100 lines
3.2 KiB
HTML

{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
<div class="block">
<div class="level">
<h2 class="title level-left">
<span>{% include 'snippets/book_titleby.html' with book=book %}</span>
</h2>
{% if request.user.is_authenticated %}
<div class="level-right">
<a href="{{ book.id }}/edit">edit
<span class="icon icon-pencil">
<span class="hidden-text">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 %}
<form name="add-cover" method="POST" action="/upload_cover/{{ book.id }}" enctype="multipart/form-data">
{% csrf_token %}
{{ cover_form.as_p }}
<button class="button" type="submit">Add cover</button>
</form>
{% endif %}
<dl class="content">
{% for field in info_fields %}
{% if field.value %}
<dt>{{ field.name }}:</dt>
<dd>{{ field.value }}</dd>
{% endif %}
{% endfor %}
</dl>
</div>
<div class="column">
<div class="block">
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ reviews|length }} review{{ reviews|length|pluralize }})</h3>
{% include 'snippets/book_description.html' %}
{% if book.parent_work.edition_set.count > 1 %}
<p><a href="/editions/{{ book.parent_work.id }}">{{ book.parent_work.edition_set.count }} editions</a></p>
{% endif %}
</div>
{% if request.user.is_authenticated %}
<div class="block">
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
</div>
<div class="block">
<h3>Tags</h3>
<form name="tag" action="/tag/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input 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>
</div>
{% if not reviews %}
<div class="block">
<p>No reviews yet!</p>
</div>
{% endif %}
<div>
{% for review in reviews %}
<div class="block">
{% include 'snippets/status.html' with status=review hide_book=True depth=1 %}
</div>
{% endfor %}
</div>
{% endblock %}