2020-01-27 21:47:54 -05:00
{% extends 'layout.html' %}
2021-02-27 17:22:39 -05:00
{% load i18n %}
2020-12-12 21:25:04 -05:00
{% load bookwyrm_tags %}
2020-09-30 19:00:41 -04:00
{% load humanize %}
2020-09-29 14:00:54 -04:00
2021-02-28 13:00:36 -05:00
{% block title %}{{ book.title }}{% endblock %}
{% block content %}
2021-04-09 17:57:49 -04:00
{% with user_authenticated=request.user.is_authenticated can_edit_book=perms.bookwyrm.edit_book %}
< div class = "block" itemscope itemtype = "https://schema.org/Book" >
2021-02-23 16:04:24 -05:00
< div class = "columns is-mobile" >
2020-12-17 17:11:24 -05:00
< div class = "column" >
< h1 class = "title" >
2021-04-09 17:57:49 -04:00
< span itemprop = "name" >
{{ book.title }}{% if book.subtitle %}:
< small > {{ book.subtitle }}< / small >
{% endif %}
< / span >
2021-01-04 19:33:45 -05:00
{% if book.series %}
2021-04-09 17:57:49 -04:00
< meta itemprop = "isPartOf" content = "{{ book.series }}" >
< meta itemprop = "volumeNumber" content = "{{ book.series_number }}" >
< small class = "has-text-grey-dark" >
({{ book.series }}
{% if book.series_number %} #{{ book.series_number }}{% endif %})
< / small >
< br >
2021-01-04 19:33:45 -05:00
{% endif %}
2021-01-04 20:42:02 -05:00
< / h1 >
{% if book.authors %}
< h2 class = "subtitle" >
2021-04-09 17:57:49 -04:00
{% trans "by" %} {% include 'snippets/authors.html' with book=book %}
2020-12-17 17:11:24 -05:00
< / h2 >
{% endif %}
< / div >
2020-09-29 14:00:54 -04:00
2021-04-09 17:57:49 -04:00
{% if user_authenticated and can_edit_book %}
2020-12-17 17:11:24 -05:00
< div class = "column is-narrow" >
2020-11-05 15:05:29 -05:00
< a href = "{{ book.id }}/edit" >
2021-02-27 17:22:39 -05:00
< span class = "icon icon-pencil" title = "{% trans " Edit Book " % } " >
< span class = "is-sr-only" > {% trans "Edit Book" %}< / span >
2020-09-29 23:36:43 -04:00
< / span >
< / a >
< / div >
{% endif %}
2020-09-29 14:00:54 -04:00
< / div >
< div class = "columns" >
2021-03-28 14:18:01 -04:00
< div class = "column is-one-fifth" >
2021-04-26 07:39:17 -04:00
{% include 'snippets/book_cover.html' with book=book cover_class='is-h-medium-mobile' %}
2021-04-25 09:37:46 -04:00
{% include 'snippets/rate_action.html' with user=request.user book=book %}
2021-03-28 14:27:09 -04:00
< div class = "mb-3" >
{% include 'snippets/shelve_button/shelve_button.html' %}
< / div >
2020-03-27 11:36:57 -04:00
2021-04-09 17:57:49 -04:00
{% if user_authenticated and not book.cover %}
2021-03-18 12:44:59 -04:00
< div class = "block" >
{% trans "Add cover" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="add-cover" controls_uid=book.id focus="modal-title-add-cover" class="is-small" %}
{% include 'book/cover_modal.html' with book=book controls_text="add-cover" controls_uid=book.id %}
2021-03-31 18:39:28 -04:00
{% if request.GET.cover_error %}
< p class = "help is-danger" > {% trans "Failed to load cover" %}< / p >
{% endif %}
2020-11-06 15:27:52 -05:00
< / div >
2020-03-28 18:06:16 -04:00
{% endif %}
2020-04-01 22:38:07 -04:00
2021-04-18 09:59:02 -04:00
< section class = "is-clipped" >
{% with book=book %}
< div class = "content" >
{% include 'book/publisher_info.html' %}
2021-01-04 20:42:02 -05:00
< / div >
2021-04-18 09:59:02 -04:00
< div class = "my-3" >
{% include 'book/book_identifiers.html' %}
2021-01-04 20:42:02 -05:00
< / div >
2021-04-18 09:59:02 -04:00
{% endwith %}
2021-01-04 20:42:02 -05:00
{% if book.openlibrary_key %}
2021-02-27 17:22:39 -05:00
< p > < a href = "https://openlibrary.org/books/{{ book.openlibrary_key }}" target = "_blank" rel = "noopener" > {% trans "View on OpenLibrary" %}< / a > < / p >
2020-04-01 22:38:07 -04:00
{% endif %}
2021-01-04 20:42:02 -05:00
< / section >
2020-03-28 18:06:16 -04:00
< / div >
2020-04-01 22:38:07 -04:00
2021-03-07 10:08:19 -05:00
< div class = "column is-three-fifths" >
2020-09-29 14:00:54 -04:00
< div class = "block" >
2021-04-09 17:57:49 -04:00
< h3
class="field is-grouped"
itemprop="aggregateRating"
itemscope
itemtype="https://schema.org/AggregateRating"
>
< meta itemprop = "ratingValue" content = "{{ rating|floatformat }}" >
{# @todo Is it possible to not hard-code the value? #}
< meta itemprop = "bestRating" content = "5" >
< meta itemprop = "reviewCount" content = "{{ review_count }}" >
2021-03-02 13:23:11 -05:00
{% include 'snippets/stars.html' with rating=rating %}
2021-04-09 17:57:49 -04:00
{% blocktrans count counter=review_count trimmed %}
({{ review_count }} review)
{% plural %}
({{ review_count }} reviews)
{% endblocktrans %}
2021-03-02 13:23:11 -05:00
< / h3 >
2020-04-01 22:38:07 -04:00
2021-04-09 17:57:49 -04:00
{% with full=book|book_description itemprop='abstract' %}
{% include 'snippets/trimmed_text.html' %}
{% endwith %}
2020-04-01 22:38:07 -04:00
2021-04-09 17:57:49 -04:00
{% if user_authenticated and can_edit_book and not book|book_description %}
2021-02-28 20:10:30 -05:00
{% trans 'Add Description' as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text controls_text="add-description" controls_uid=book.id focus="id_description" hide_active=True id="hide-description" %}
2021-01-17 11:26:28 -05:00
2021-04-07 11:31:00 -04:00
< div class = "box is-hidden" id = "add-description-{{ book.id }}" >
2021-01-17 11:26:28 -05:00
< form name = "add-description" method = "POST" action = "/add-description/{{ book.id }}" >
{% csrf_token %}
< p class = "fields is-grouped" >
2021-02-27 17:22:39 -05:00
< label class = "label" for = "id_description" > {% trans "Description:" %}< / label >
2021-01-17 11:26:28 -05:00
< textarea name = "description" cols = "None" rows = "None" class = "textarea" id = "id_description" > < / textarea >
< / p >
< div class = "field" >
2021-02-27 17:22:39 -05:00
< button class = "button is-primary" type = "submit" > {% trans "Save" %}< / button >
2021-02-28 20:10:30 -05:00
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="add-description" controls_uid=book.id hide_inactive=True %}
2020-11-28 10:55:31 -05:00
< / div >
2021-01-17 11:26:28 -05:00
< / form >
2020-11-28 10:55:31 -05:00
< / div >
{% endif %}
2020-12-08 12:43:12 -05:00
{% if book.parent_work.editions.count > 1 %}
2021-03-02 13:23:11 -05:00
< p > {% blocktrans with path=book.parent_work.local_path count=book.parent_work.editions.count %}< a href = "{{ path }}/editions" > {{ count }} editions< / a > {% endblocktrans %}< / p >
2020-09-29 14:00:54 -04:00
{% endif %}
< / div >
2020-04-01 22:38:07 -04:00
2020-12-11 19:39:58 -05:00
{# user's relationship to the book #}
2021-01-06 21:34:21 -05:00
< div class = "block" >
2020-12-11 19:39:58 -05:00
{% for shelf in user_shelves %}
< p >
2021-03-02 13:23:11 -05:00
{% blocktrans with path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}This edition is on your < a href = "{{ path }}" > {{ shelf_name }}< / a > shelf.{% endblocktrans %}
2020-12-11 19:39:58 -05:00
{% include 'snippets/shelf_selector.html' with current=shelf.shelf %}
< / p >
{% endfor %}
{% for shelf in other_edition_shelves %}
< p >
2021-03-02 13:23:11 -05:00
{% blocktrans with book_path=shelf.book.local_path shelf_path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}A < a href = "{{ book_path }}" > different edition< / a > of this book is on your < a href = "{{ shelf_path }}" > {{ shelf_name }}< / a > shelf.{% endblocktrans %}
2020-12-11 19:57:38 -05:00
{% include 'snippets/switch_edition_button.html' with edition=book %}
2020-12-11 19:39:58 -05:00
< / p >
{% endfor %}
2021-01-06 21:34:21 -05:00
< / div >
2020-11-06 15:51:49 -05:00
2021-04-09 17:57:49 -04:00
{% if user_authenticated %}
2021-01-17 20:22:03 -05:00
< section class = "block" >
< header class = "columns" >
2021-02-27 17:22:39 -05:00
< h2 class = "column title is-5 mb-1" > {% trans "Your reading activity" %}< / h2 >
2021-01-17 20:22:03 -05:00
< div class = "column is-narrow" >
2021-02-28 20:10:30 -05:00
{% trans "Add read dates" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon="plus" class="is-small" controls_text="add-readthrough" %}
2021-01-17 20:22:03 -05:00
< / div >
< / header >
2021-02-02 12:44:29 -05:00
{% if not readthroughs.exists %}
2021-02-27 17:22:39 -05:00
< p > {% trans "You don't have any reading activity for this book." %}< / p >
2021-02-02 12:44:29 -05:00
{% endif %}
2021-04-07 11:31:00 -04:00
< section class = "is-hidden box" id = "add-readthrough" >
2021-01-17 11:26:28 -05:00
< form name = "add-readthrough" action = "/create-readthrough" method = "post" >
{% include 'snippets/readthrough_form.html' with readthrough=None %}
< div class = "field is-grouped" >
2021-01-17 20:22:03 -05:00
< div class = "control" >
2021-02-27 17:22:39 -05:00
< button class = "button is-primary" type = "submit" > {% trans "Create" %}< / button >
2021-01-17 20:22:03 -05:00
< / div >
< div class = "control" >
2021-02-28 20:10:30 -05:00
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="add-readthrough" %}
2021-01-17 20:22:03 -05:00
< / div >
2021-01-17 11:26:28 -05:00
< / div >
< / form >
2021-01-17 20:22:03 -05:00
< / section >
{% for readthrough in readthroughs %}
{% include 'snippets/readthrough.html' with readthrough=readthrough %}
{% endfor %}
< / section >
2020-10-29 15:32:37 -04:00
2021-01-17 23:19:09 -05:00
< section class = "box" >
2020-04-21 11:01:54 -04:00
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
2021-01-17 23:19:09 -05:00
< / section >
2020-09-29 14:00:54 -04:00
{% endif %}
2020-04-12 00:49:06 -04:00
< / div >
2021-03-07 10:08:19 -05:00
< div class = "column is-one-fifth" >
2021-01-04 20:42:02 -05:00
{% if book.subjects %}
2021-04-09 17:57:49 -04:00
< section class = "content block" >
< h2 class = "title is-5" > {% trans "Subjects" %}< / h2 >
< ul >
{% for subject in book.subjects %}
< li itemprop = "about" > {{ subject }}< / li >
{% endfor %}
< / ul >
< / section >
2021-01-04 20:42:02 -05:00
{% endif %}
{% if book.subject_places %}
< section class = "content block" >
2021-02-27 17:22:39 -05:00
< h2 class = "title is-5" > {% trans "Places" %}< / h2 >
2021-01-04 20:42:02 -05:00
< ul >
2021-03-07 10:35:38 -05:00
{% for place in book.subject_places %}
2021-01-04 20:42:02 -05:00
< li > {{ place }}< / li >
{% endfor %}
< / ul >
< / section >
{% endif %}
2021-02-15 14:30:22 -05:00
2021-03-15 17:44:03 -04:00
{% if lists.exists or request.user.list_set.exists %}
2021-02-15 14:30:22 -05:00
< section class = "content block" >
2021-02-27 17:22:39 -05:00
< h2 class = "title is-5" > {% trans "Lists" %}< / h2 >
2021-02-15 14:30:22 -05:00
< ul >
{% for list in lists %}
< li > < a href = "{{ list.local_path }}" > {{ list.name }}< / a > < / li >
{% endfor %}
< / ul >
2021-03-15 17:44:03 -04:00
{% if request.user.list_set.exists %}
< form name = "list-add" method = "post" action = "{% url 'list-add-book' %}" >
{% csrf_token %}
< input type = "hidden" name = "book" value = "{{ book.id }}" >
< label class = "label" for = "id_list" > {% trans "Add to list" %}< / label >
< div class = "field has-addons" >
< div class = "select control" >
< select name = "list" id = "id_list" >
{% for list in user.list_set.all %}
< option value = "{{ list.id }}" > {{ list.name }}< / option >
{% endfor %}
< / select >
< / div >
< div class = "control" >
< button type = "submit" class = "button is-link" > {% trans "Add" %}< / button >
< / div >
< / div >
< / form >
{% endif %}
2021-02-15 14:30:22 -05:00
< / section >
{% endif %}
2021-01-04 20:42:02 -05:00
< / div >
2020-02-23 17:26:03 -05:00
< / div >
2021-04-09 17:57:49 -04:00
< div class = "block" id = "reviews" >
2021-04-23 16:32:58 -04:00
{% if request.user.is_authenticated %}
< nav class = "tabs" >
< ul >
{% url 'book' book.id as tab_url %}
< li { % if tab_url = = request . path % } class = "is-active" { % endif % } >
2021-04-23 16:46:22 -04:00
< a href = "{{ tab_url }}" > {% trans "Reviews" %} ({{ review_count }})< / a >
2021-04-23 16:32:58 -04:00
< / li >
{% if user_statuses.review_count %}
{% url 'book-user-statuses' book.id 'review' as tab_url %}
< li { % if tab_url = = request . path % } class = "is-active" { % endif % } >
< a href = "{{ tab_url }}" > {% trans "Your reviews" %} ({{ user_statuses.review_count }})< / a >
< / li >
{% endif %}
{% if user_statuses.comment_count %}
{% url 'book-user-statuses' book.id 'comment' as tab_url %}
< li { % if tab_url = = request . path % } class = "is-active" { % endif % } >
< a href = "{{ tab_url }}" > {% trans "Your comments" %} ({{ user_statuses.comment_count }})< / a >
< / li >
{% endif %}
{% if user_statuses.quotation_count %}
{% url 'book-user-statuses' book.id 'quote' as tab_url %}
< li { % if tab_url = = request . path % } class = "is-active" { % endif % } >
< a href = "{{ tab_url }}" > {% trans "Your quotes" %} ({{ user_statuses.quotation_count }})< / a >
< / li >
{% endif %}
< / ul >
< / nav >
{% endif %}
{% for review in statuses %}
2021-04-09 17:57:49 -04:00
< div
class="block"
itemprop="review"
itemscope
itemtype="https://schema.org/Review"
>
{% with status=review hide_book=True depth=1 %}
{% include 'snippets/status/status.html' %}
{% endwith %}
2020-09-30 19:00:41 -04:00
< / div >
2021-01-13 12:42:54 -05:00
{% endfor %}
2021-04-09 17:57:49 -04:00
< div class = "block is-flex is-flex-wrap-wrap" >
{% for rating in ratings %}
{% with user=rating.user %}
< div class = "block mr-5" >
< div class = "media" >
< div class = "media-left" >
{% include 'snippets/avatar.html' %}
< / div >
< div class = "media-content" >
< div >
< a href = "{{ user.local_path }}" > {{ user.display_name }}< / a >
< / div >
< div class = "is-flex" >
< p class = "mr-1" > {% trans "rated it" %}< / p >
{% include 'snippets/stars.html' with rating=rating.rating %}
< / div >
< div >
< a href = "{{ rating.remote_id }}" > {{ rating.published_date | naturaltime }}< / a >
< / div >
< / div >
< / div >
< / div >
{% endwith %}
{% endfor %}
< / div >
< div class = "block" >
2021-04-23 16:35:12 -04:00
{% include 'snippets/pagination.html' with page=statuses path=request.path anchor="#reviews" %}
2021-04-09 17:57:49 -04:00
< / div >
2020-09-30 19:00:41 -04:00
< / div >
2020-03-16 20:19:38 -04:00
< / div >
2021-04-09 17:57:49 -04:00
{% endwith %}
2020-01-27 21:47:54 -05:00
{% endblock %}
2021-03-22 15:37:01 -04:00
{% block scripts %}
2021-04-05 10:17:11 -04:00
< script src = "/static/js/vendor/tabs.js" > < / script >
2021-03-22 15:37:01 -04:00
{% endblock %}