2020-01-28 02:47:54 +00:00
{% extends 'layout.html' %}
2021-02-27 22:22:39 +00:00
{% load i18n %}
2020-12-13 02:25:04 +00:00
{% load bookwyrm_tags %}
2020-09-30 23:00:41 +00:00
{% load humanize %}
2020-09-29 18:00:54 +00:00
2021-02-28 18:00:36 +00:00
{% block title %}{{ book.title }}{% endblock %}
{% block content %}
2020-09-29 18:00:54 +00:00
< div class = "block" >
2021-02-23 21:04:24 +00:00
< div class = "columns is-mobile" >
2020-12-17 22:11:24 +00:00
< div class = "column" >
< h1 class = "title" >
{{ book.title }}{% if book.subtitle %}:
< small > {{ book.subtitle }}< / small > {% endif %}
2021-01-05 00:33:45 +00:00
{% if book.series %}
< small class = "has-text-grey-dark" > ({{ book.series }}{% if book.series_number %} #{{ book.series_number }}{% endif %})< / small > < br >
{% endif %}
2021-01-05 01:42:02 +00:00
< / h1 >
{% if book.authors %}
< h2 class = "subtitle" >
2021-03-02 18:23:11 +00:00
{% trans "by" %} {% include 'snippets/authors.html' with book=book %}
2020-12-17 22:11:24 +00:00
< / h2 >
{% endif %}
< / div >
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-12-17 22:11:24 +00:00
< div class = "column is-narrow" >
2020-11-05 20:05:29 +00:00
< a href = "{{ book.id }}/edit" >
2021-02-27 22:22:39 +00:00
< span class = "icon icon-pencil" title = "{% trans " Edit Book " % } " >
< span class = "is-sr-only" > {% trans "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" >
2021-03-07 15:08:19 +00:00
< div class = "column is-one-fifth" >
2020-02-23 22:26:03 +00:00
{% include 'snippets/book_cover.html' with book=book size=large %}
2020-04-04 19:35:28 +00:00
{% include 'snippets/rate_action.html' with user=request.user book=book %}
2021-01-30 23:59:50 +00:00
{% include 'snippets/shelve_button/shelve_button.html' %}
2020-03-27 15:36:57 +00:00
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" >
2021-02-27 22:22:39 +00:00
< h3 class = "title is-6 mb-1" > {% trans "Add cover" %}< / h3 >
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 %}
2021-02-23 21:23:41 +00:00
< label class = "label" >
< input type = "file" name = "cover" accept = "image/*" enctype = "multipart/form-data" id = "id_cover" required >
< / label >
2021-02-27 22:22:39 +00:00
< button class = "button is-small is-primary" type = "submit" > {% trans "Add" %}< / button >
2020-11-06 20:27:52 +00:00
< / form >
< / div >
2020-03-28 22:06:16 +00:00
{% endif %}
2020-04-02 02:38:07 +00:00
2021-01-05 01:42:02 +00:00
< section class = "content" >
< dl >
{% if book.isbn_13 %}
< div class = "is-flex is-justify-content-space-between" >
2021-02-27 22:22:39 +00:00
< dt > {% trans "ISBN:" %}< / dt >
2021-01-05 01:42:02 +00:00
< dd > {{ book.isbn_13 }}< / dd >
< / div >
{% endif %}
{% if book.oclc_number %}
< div class = "is-flex is-justify-content-space-between" >
2021-02-27 22:22:39 +00:00
< dt > {% trans "OCLC Number:" %}< / dt >
2021-01-05 01:42:02 +00:00
< dd > {{ book.oclc_number }}< / dd >
< / div >
{% endif %}
{% if book.asin %}
< div class = "is-flex is-justify-content-space-between" >
2021-02-27 22:22:39 +00:00
< dt > {% trans "ASIN:" %}< / dt >
2021-01-05 01:42:02 +00:00
< dd > {{ book.asin }}< / dd >
< / div >
{% endif %}
< / dl >
< p >
2021-03-02 18:23:11 +00:00
{% if book.physical_format and not book.pages %}
{{ book.physical_format | title }}
{% elif book.physical_format and book.pages %}
{% blocktrans with format=book.physical_format|title pages=book.pages %}{{ format }}, {{ pages }} pages{% endblocktrans %}
{% elif book.pages %}
{% blocktrans with pages=book.pages %}{{ pages }} pages{% endblocktrans %}
{% endif %}
2021-01-05 01:42:02 +00:00
< / p >
{% if book.openlibrary_key %}
2021-02-27 22:22:39 +00:00
< p > < a href = "https://openlibrary.org/books/{{ book.openlibrary_key }}" target = "_blank" rel = "noopener" > {% trans "View on OpenLibrary" %}< / a > < / p >
2020-04-02 02:38:07 +00:00
{% endif %}
2021-01-05 01:42:02 +00:00
< / section >
2020-03-28 22:06:16 +00:00
< / div >
2020-04-02 02:38:07 +00:00
2021-03-07 15:08:19 +00:00
< div class = "column is-three-fifths" >
2020-09-29 18:00:54 +00:00
< div class = "block" >
2021-03-02 18:23:11 +00:00
< h3 class = "field is-grouped" >
{% include 'snippets/stars.html' with rating=rating %}
2021-03-02 18:46:08 +00:00
{% blocktrans count counter=review_count %}({{ review_count }} review){% plural %}({{ review_count }} reviews){% endblocktrans %}
2021-03-02 18:23:11 +00:00
< / 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-11-28 16:29:55 +00:00
{% if request.user.is_authenticated and perms.bookwyrm.edit_book and not book|book_description %}
2021-03-01 01:10:30 +00: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 16:26:28 +00:00
< div class = "box hidden" id = "add-description-{{ book.id }}" >
< form name = "add-description" method = "POST" action = "/add-description/{{ book.id }}" >
{% csrf_token %}
< p class = "fields is-grouped" >
2021-02-27 22:22:39 +00:00
< label class = "label" for = "id_description" > {% trans "Description:" %}< / label >
2021-01-17 16:26:28 +00:00
< textarea name = "description" cols = "None" rows = "None" class = "textarea" id = "id_description" > < / textarea >
< / p >
< div class = "field" >
2021-02-27 22:22:39 +00:00
< button class = "button is-primary" type = "submit" > {% trans "Save" %}< / button >
2021-03-01 01:10:30 +00: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 15:55:31 +00:00
< / div >
2021-01-17 16:26:28 +00:00
< / form >
2020-11-28 15:55:31 +00:00
< / div >
{% endif %}
2020-12-08 17:43:12 +00:00
{% if book.parent_work.editions.count > 1 %}
2021-03-02 18:23:11 +00: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 18:00:54 +00:00
{% endif %}
< / div >
2020-04-02 02:38:07 +00:00
2020-12-12 00:39:58 +00:00
{# user's relationship to the book #}
2021-01-07 02:34:21 +00:00
< div class = "block" >
2020-12-12 00:39:58 +00:00
{% for shelf in user_shelves %}
< p >
2021-03-02 18:23:11 +00: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-12 00:39:58 +00:00
{% include 'snippets/shelf_selector.html' with current=shelf.shelf %}
< / p >
{% endfor %}
{% for shelf in other_edition_shelves %}
< p >
2021-03-02 18:23:11 +00: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-12 00:57:38 +00:00
{% include 'snippets/switch_edition_button.html' with edition=book %}
2020-12-12 00:39:58 +00:00
< / p >
{% endfor %}
2021-01-07 02:34:21 +00:00
< / div >
2020-11-06 20:51:49 +00:00
2021-02-02 17:44:29 +00:00
{% if request.user.is_authenticated %}
2021-01-18 01:22:03 +00:00
< section class = "block" >
< header class = "columns" >
2021-02-27 22:22:39 +00:00
< h2 class = "column title is-5 mb-1" > {% trans "Your reading activity" %}< / h2 >
2021-01-18 01:22:03 +00:00
< div class = "column is-narrow" >
2021-03-01 01:10:30 +00: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-18 01:22:03 +00:00
< / div >
< / header >
2021-02-02 17:44:29 +00:00
{% if not readthroughs.exists %}
2021-02-27 22:22:39 +00:00
< p > {% trans "You don't have any reading activity for this book." %}< / p >
2021-02-02 17:44:29 +00:00
{% endif %}
2021-01-18 01:22:03 +00:00
< section class = "hidden box" id = "add-readthrough" >
2021-01-17 16:26:28 +00: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-18 01:22:03 +00:00
< div class = "control" >
2021-02-27 22:22:39 +00:00
< button class = "button is-primary" type = "submit" > {% trans "Create" %}< / button >
2021-01-18 01:22:03 +00:00
< / div >
< div class = "control" >
2021-03-01 01:10:30 +00:00
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="add-readthrough" %}
2021-01-18 01:22:03 +00:00
< / div >
2021-01-17 16:26:28 +00:00
< / div >
< / form >
2021-01-18 01:22:03 +00:00
< / section >
{% for readthrough in readthroughs %}
{% include 'snippets/readthrough.html' with readthrough=readthrough %}
{% endfor %}
< / section >
{% endif %}
2020-10-29 19:32:37 +00:00
2020-04-04 20:12:15 +00:00
{% if request.user.is_authenticated %}
2021-01-18 04:19:09 +00:00
< section class = "box" >
2020-04-21 15:01:54 +00:00
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
2021-01-18 04:19:09 +00:00
< / section >
2020-04-04 20:12:15 +00:00
2021-01-18 04:19:09 +00:00
< section class = "block" >
2020-04-04 20:12:15 +00:00
< form name = "tag" action = "/tag/" method = "post" >
2021-02-27 22:22:39 +00:00
< label for = "tags" class = "is-3" > {% trans "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 }}" >
2020-11-08 21:42:01 +00:00
< input id = "tags" class = "input" type = "text" name = "name" >
2021-02-27 22:22:39 +00:00
< button class = "button" type = "submit" > {% trans "Add tag" %}< / button >
2020-04-04 20:12:15 +00:00
< / form >
2021-01-18 04:19:09 +00:00
< / section >
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 >
2021-03-07 15:08:19 +00:00
< div class = "column is-one-fifth" >
2021-01-05 01:42:02 +00:00
{% if book.subjects %}
< section class = "content block" >
2021-02-27 22:22:39 +00:00
< h2 class = "title is-5" > {% trans "Subjects" %}< / h2 >
2021-01-05 01:42:02 +00:00
< ul >
{% for subject in book.subjects %}
< li > {{ subject }}< / li >
{% endfor %}
< / ul >
< / section >
{% endif %}
{% if book.subject_places %}
< section class = "content block" >
2021-02-27 22:22:39 +00:00
< h2 class = "title is-5" > {% trans "Places" %}< / h2 >
2021-01-05 01:42:02 +00:00
< ul >
2021-03-07 15:35:38 +00:00
{% for place in book.subject_places %}
2021-01-05 01:42:02 +00:00
< li > {{ place }}< / li >
{% endfor %}
< / ul >
< / section >
{% endif %}
2021-02-15 19:30:22 +00:00
{% if lists.exists %}
< section class = "content block" >
2021-02-27 22:22:39 +00:00
< h2 class = "title is-5" > {% trans "Lists" %}< / h2 >
2021-02-15 19:30:22 +00:00
< ul >
{% for list in lists %}
< li > < a href = "{{ list.local_path }}" > {{ list.name }}< / a > < / li >
{% endfor %}
< / ul >
< / section >
{% endif %}
2021-01-05 01:42:02 +00:00
< / div >
2020-02-23 22:26:03 +00:00
< / div >
2020-03-17 00:19:38 +00:00
< / div >
2020-02-23 22:26:03 +00:00
2021-01-13 17:42:54 +00:00
< div class = "block" id = "reviews" >
2020-09-29 20:11:52 +00:00
{% for review in reviews %}
< div class = "block" >
2021-02-23 21:34:16 +00:00
{% include 'snippets/status/status.html' with status=review hide_book=True depth=1 %}
2020-09-29 20:11:52 +00:00
< / div >
{% endfor %}
2020-09-30 23:00:41 +00:00
2021-01-05 01:46:14 +00:00
< div class = "block is-flex is-flex-wrap-wrap" >
2021-01-13 17:42:54 +00:00
{% 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" >
2021-02-27 22:22:39 +00:00
< div > {% trans "rated it" %}< / div >
2021-01-13 17:42:54 +00:00
{% include 'snippets/stars.html' with rating=rating.rating %}
< / div >
< div >
< a href = "{{ rating.remote_id }}" > {{ rating.published_date | naturaltime }}< / a >
< / div >
2020-09-30 23:00:41 +00:00
< / div >
< / div >
< / div >
2021-01-13 17:42:54 +00:00
{% endfor %}
2020-09-30 23:00:41 +00:00
< / div >
2021-01-13 17:42:54 +00:00
< div class = "block" >
{% include 'snippets/pagination.html' with page=reviews path=book.local_path anchor="#reviews" %}
2020-09-30 23:00:41 +00:00
< / div >
2020-03-17 00:19:38 +00:00
< / div >
2020-09-30 23:00:41 +00:00
2020-01-28 02:47:54 +00:00
{% endblock %}