From 7c9518afa6614a276de6fd762d8c1eb065ce7d38 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 29 Mar 2021 10:21:48 -0700 Subject: [PATCH] Adds info to editions page --- bookwyrm/templates/book/book.html | 19 +----------- bookwyrm/templates/book/editions.html | 33 +++++++++++++++++++++ bookwyrm/templates/book/publisher_info.html | 24 +++++++++++++++ bookwyrm/templates/editions.html | 14 --------- bookwyrm/views/books.py | 2 +- 5 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 bookwyrm/templates/book/editions.html create mode 100644 bookwyrm/templates/book/publisher_info.html delete mode 100644 bookwyrm/templates/editions.html diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index aef8fba1..95cf86ad 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -76,24 +76,7 @@ {% endif %} -

- {% 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 %} -

-

- {% if book.published_date and book.publishers %} - {% blocktrans with date=book.published_date|date:'M jS Y' publisher=book.publishers|join:', ' %}Published {{ date }} by {{ publisher }}.{% endblocktrans %} - {% elif book.published_date %} - {% blocktrans with date=book.published_date|date:'M jS Y' %}Published {{ date }}{% endblocktrans %} - {% elif book.publishers %} - {% blocktrans with publisher=book.publishers|join:', ' %}Published by {{ publisher }}.{% endblocktrans %} - {% endif %} -

+ {% include 'book/publisher_info.html' with book=book %} {% if book.openlibrary_key %}

{% trans "View on OpenLibrary" %}

diff --git a/bookwyrm/templates/book/editions.html b/bookwyrm/templates/book/editions.html new file mode 100644 index 00000000..b77dc1a6 --- /dev/null +++ b/bookwyrm/templates/book/editions.html @@ -0,0 +1,33 @@ +{% extends 'layout.html' %} +{% load i18n %} +{% load bookwyrm_tags %} + +{% block title %}{% blocktrans with book_title=work.title %}Editions of {{ book_title }}{% endblocktrans %}{% endblock %} + +{% block content %} +
+

{% blocktrans with work_path=work.local_path work_title=work.title %}Editions of "{{ work_title }}"{% endblocktrans %}

+ + {% for book in editions %} +
+ +
+

+ + {{ book.title }} + +

+ {% include 'book/publisher_info.html' with book=book %} +
+
+ {% include 'snippets/shelve_button/shelve_button.html' with book=book switch_mode=True %} +
+
+ {% endfor %} +
+{% endblock %} + diff --git a/bookwyrm/templates/book/publisher_info.html b/bookwyrm/templates/book/publisher_info.html new file mode 100644 index 00000000..0ab35401 --- /dev/null +++ b/bookwyrm/templates/book/publisher_info.html @@ -0,0 +1,24 @@ +{% load i18n %} +

+ {% 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 %} +

+{% if book.languages %} +

+ {% blocktrans with languages=book.languages|join:", " %}{{ languages }} language{% endblocktrans %} +

+{% endif %} +

+ {% if book.published_date and book.publishers %} + {% blocktrans with date=book.published_date|date:'M jS Y' publisher=book.publishers|join:', ' %}Published {{ date }} by {{ publisher }}.{% endblocktrans %} + {% elif book.published_date %} + {% blocktrans with date=book.published_date|date:'M jS Y' %}Published {{ date }}{% endblocktrans %} + {% elif book.publishers %} + {% blocktrans with publisher=book.publishers|join:', ' %}Published by {{ publisher }}.{% endblocktrans %} + {% endif %} +

diff --git a/bookwyrm/templates/editions.html b/bookwyrm/templates/editions.html deleted file mode 100644 index f8319757..00000000 --- a/bookwyrm/templates/editions.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'layout.html' %} -{% load i18n %} -{% load bookwyrm_tags %} - -{% block title %}{% blocktrans with book_title=work.title %}Editions of {{ book_title }}{% endblocktrans %}{% endblock %} - -{% block content %} -
-

{% blocktrans with work_path=work.local_path work_title=work.title %}Editions of "{{ work_title }}"{% endblocktrans %}

- - {% include 'snippets/book_tiles.html' with books=editions %} -
-{% endblock %} - diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index cabc3223..5c8eab4c 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -257,7 +257,7 @@ class Editions(View): "editions": work.editions.order_by("-edition_rank").all(), "work": work, } - return TemplateResponse(request, "editions.html", data) + return TemplateResponse(request, "book/editions.html", data) @login_required