bookwyrm/bookwyrm/templates/book.html

215 lines
9 KiB
HTML
Raw Normal View History

2020-01-28 02:47:54 +00:00
{% extends 'layout.html' %}
2020-01-29 23:10:32 +00:00
{% load fr_display %}
{% load humanize %}
2020-01-28 02:47:54 +00:00
{% block content %}
2020-09-29 18:00:54 +00:00
<div class="block">
<div class="level">
2020-11-09 20:06:44 +00:00
<h1 class="title level-left">
2020-09-29 18:00:54 +00:00
<span>{% include 'snippets/book_titleby.html' with book=book %}</span>
2020-11-09 20:06:44 +00:00
</h1>
2020-09-29 18:00:54 +00:00
2020-10-01 20:09:37 +00:00
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
2020-09-30 03:36:43 +00:00
<div class="level-right">
2020-11-05 20:05:29 +00:00
<a href="{{ book.id }}/edit">
2020-09-30 03:36:43 +00:00
<span class="icon icon-pencil">
2020-09-30 22:10:37 +00:00
<span class="is-sr-only">Edit Book</span>
2020-09-30 03:36:43 +00:00
</span>
</a>
</div>
{% endif %}
2020-09-29 18:00:54 +00:00
</div>
<div class="columns">
2020-09-30 03:36:43 +00: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 22:06:16 +00:00
{% if request.user.is_authenticated and not book.cover %}
2020-11-06 20:27:52 +00:00
<div class="box p-2">
2020-11-11 05:34:26 +00:00
<form name="add-cover" method="POST" action="/upload-cover/{{ book.id }}" enctype="multipart/form-data">
2020-11-06 20:27:52 +00: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 22:06:16 +00:00
{% endif %}
2020-04-02 02:38:07 +00:00
2020-09-29 18:00:54 +00:00
<dl class="content">
{% for field in info_fields %}
2020-04-02 02:38:07 +00:00
{% if field.value %}
<dt>{{ field.name }}:</dt>
<dd>{{ field.value }}</dd>
{% endif %}
2020-09-29 18:00:54 +00:00
{% endfor %}
2020-04-02 02:38:07 +00:00
</dl>
2020-03-28 22:06:16 +00:00
</div>
2020-04-02 02:38:07 +00:00
2020-09-30 03:36:43 +00:00
<div class="column">
2020-09-29 18:00:54 +00:00
<div class="block">
2020-09-30 16:00:33 +00:00
<h3 class="field is-grouped">{% include 'snippets/stars.html' with rating=rating %} ({{ reviews|length }} review{{ reviews|length|pluralize }})</h3>
2020-04-02 02:38:07 +00:00
2020-11-12 19:40:20 +00:00
{% include 'snippets/trimmed_text.html' with full=book|book_description %}
2020-04-02 02:38:07 +00:00
2020-09-29 18:00:54 +00:00
{% if book.parent_work.edition_set.count > 1 %}
2020-11-04 20:55:00 +00:00
<p><a href="/book/{{ book.parent_work.id }}/editions">{{ book.parent_work.edition_set.count }} editions</a></p>
2020-09-29 18:00:54 +00:00
{% endif %}
</div>
2020-04-02 02:38:07 +00:00
2020-10-29 19:32:37 +00:00
{% for readthrough in readthroughs %}
2020-10-30 05:38:01 +00:00
<div class="content block">
<input class="toggle-control" type="radio" name="show-edit-readthrough" id="show-readthrough-{{ readthrough.id }}" checked>
<div class="toggle-content hidden">
<dl>
2020-11-06 20:40:21 +00:00
{% if readthrough.start_date %}
2020-10-30 05:38:01 +00:00
<dt>Started reading:</dt>
<dd>{{ readthrough.start_date | naturalday }}</dd>
2020-11-06 20:40:21 +00:00
{% endif %}
{% if readthrough.finish_date %}
2020-10-30 05:38:01 +00:00
<dt>Finished reading:</dt>
<dd>{{ readthrough.finish_date | naturalday }}</dd>
2020-11-06 20:40:21 +00:00
{% endif %}
2020-10-30 05:38:01 +00:00
</dl>
<div class="field is-grouped">
<label class="button is-small" for="edit-readthrough-{{ readthrough.id }}" role="button" tabindex="0">
2020-10-30 05:38:01 +00:00
<span class="icon icon-pencil">
<span class="is-sr-only">Edit read-through dates</span>
2020-10-30 05:38:01 +00:00
</span>
</label>
<label class="button is-small" for="delete-readthrough-{{ readthrough.id }}" role="button" tabindex="0">
2020-11-06 20:51:49 +00:00
<span class="icon icon-x">
<span class="is-sr-only">Delete this read-through</span>
2020-11-06 20:51:49 +00:00
</span>
</label>
2020-10-30 05:38:01 +00:00
</div>
</div>
</div>
<div class="block">
2020-10-30 05:38:01 +00:00
<input class="toggle-control" type="radio" name="show-edit-readthrough" id="edit-readthrough-{{ readthrough.id }}">
<div class="toggle-content hidden">
<div class="box">
<form name="edit-readthrough" action="/edit-readthrough" method="post">
{% csrf_token %}
<input type="hidden" name="id" value="{{ readthrough.id }}">
<div class="field">
<label class="label">
Started reading
<input type="date" name="start_date" class="input" id="id_start_date-{{ readthrough.id }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
</label>
</div>
<div class="field">
<label class="label">
Finished reading
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ readthrough.id }}" value="{{ readthrough.finish_date | date:"Y-m-d" }}">
</label>
</div>
<div class="field is-grouped">
<button class="button is-primary" type="submit">Save</button>
<label class="button" for="show-readthrough-{{ readthrough.id }}">Cancel</label>
</div>
</form>
</div>
2020-10-30 05:38:01 +00:00
</div>
2020-10-29 19:32:37 +00:00
</div>
2020-11-06 20:51:49 +00:00
<div>
<input class="toggle-control" type="checkbox" name="delete-readthrough-{{ readthrough.id }}" id="delete-readthrough-{{ readthrough.id }}">
<div class="modal toggle-content hidden">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Delete this read-though?</p>
<label class="delete" for="delete-readthrough-{{ readthrough.id }}" aria-label="close"></label>
</header>
<footer class="modal-card-foot">
<form name="delete-readthrough-{{ readthrough.id }}" action="/delete-readthrough" method="POST">
{% csrf_token %}
<input type="hidden" name="id" value="{{ readthrough.id }}">
2020-11-09 20:10:37 +00:00
<button class="button is-danger is-light" type="submit">
2020-11-06 20:51:49 +00:00
Delete
</button>
<label for="delete-readthrough-{{ readthrough.id }}" class="button">Cancel</button>
</form>
</footer>
</div>
<label class="modal-close is-large" for="delete-readthrough-{{ readthrough.id }}" aria-label="close"></label>
</div>
</div>
2020-10-29 19:32:37 +00:00
{% endfor %}
2020-04-04 20:12:15 +00:00
{% if request.user.is_authenticated %}
<div class="box">
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
2020-04-02 02:38:07 +00:00
</div>
2020-04-04 20:12:15 +00:00
2020-09-29 18:00:54 +00:00
<div class="block">
2020-04-04 20:12:15 +00:00
<form name="tag" action="/tag/" method="post">
<label for="tags" class="is-3">Tags</label>
2020-04-04 20:12:15 +00:00
{% csrf_token %}
2020-05-04 00:53:14 +00:00
<input type="hidden" name="book" value="{{ book.id }}">
<input id="tags" class="input" type="text" name="name">
2020-09-29 18:00:54 +00:00
<button class="button" type="submit">Add tag</button>
2020-04-04 20:12:15 +00:00
</form>
</div>
2020-09-29 18:00:54 +00:00
{% endif %}
<div class="block">
2020-09-29 21:11:55 +00:00
<div class="field is-grouped is-grouped-multiline">
2020-04-04 20:12:15 +00:00
{% for tag in tags %}
{% include 'snippets/tag.html' with book=book tag=tag user_tags=user_tags %}
{% endfor %}
2020-09-29 21:11:55 +00:00
</div>
2020-04-04 20:12:15 +00:00
</div>
2020-04-12 04:49:06 +00:00
</div>
</div>
2020-03-17 00:19:38 +00:00
</div>
2020-03-17 00:19:38 +00:00
{% if not reviews %}
2020-09-29 18:00:54 +00:00
<div class="block">
2020-03-17 00:19:38 +00:00
<p>No reviews yet!</p>
</div>
{% endif %}
<div class="block">
2020-09-29 20:11:52 +00: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">
<div class="media-left">{% include 'snippets/avatar.html' %}</div>
<div class="media-content">
<div>
{% include 'snippets/username.html' %}
</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-17 00:19:38 +00:00
</div>
2020-01-28 02:47:54 +00:00
{% endblock %}