From 2d2ccd51df4801d2219ad46c2d7bff99d9afc6c3 Mon Sep 17 00:00:00 2001 From: Bart Schuurmans Date: Sat, 23 Mar 2024 19:35:24 +0100 Subject: [PATCH] Factor out book series info into separate template --- bookwyrm/templates/snippets/book_series.html | 3 +++ bookwyrm/templates/snippets/book_titleby.html | 8 ++------ bookwyrm/templates/snippets/status/headers/comment.html | 4 +--- bookwyrm/templates/snippets/status/headers/quotation.html | 4 +--- bookwyrm/templates/snippets/status/headers/read.html | 4 +--- bookwyrm/templates/snippets/status/headers/reading.html | 4 +--- bookwyrm/templates/snippets/status/headers/review.html | 4 +--- .../snippets/status/headers/stopped_reading.html | 4 +--- bookwyrm/templates/snippets/status/headers/to_read.html | 4 +--- 9 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 bookwyrm/templates/snippets/book_series.html diff --git a/bookwyrm/templates/snippets/book_series.html b/bookwyrm/templates/snippets/book_series.html new file mode 100644 index 000000000..fd1343604 --- /dev/null +++ b/bookwyrm/templates/snippets/book_series.html @@ -0,0 +1,3 @@ +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} diff --git a/bookwyrm/templates/snippets/book_titleby.html b/bookwyrm/templates/snippets/book_titleby.html index 35e0c4c45..518d96389 100644 --- a/bookwyrm/templates/snippets/book_titleby.html +++ b/bookwyrm/templates/snippets/book_titleby.html @@ -9,8 +9,7 @@ {% if book.authors.exists %} {% blocktrans trimmed with path=book.local_path title=book|book_title %} -{{ title }} - +{{ title }} by {% endblocktrans %} {% include 'snippets/authors.html' with book=book limit=3 %} @@ -18,10 +17,7 @@ by {{ book|book_title }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} - +{% include 'snippets/book_series.html' with book=book %} {% endcache %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/comment.html b/bookwyrm/templates/snippets/status/headers/comment.html index b7750d3df..72bf5b255 100644 --- a/bookwyrm/templates/snippets/status/headers/comment.html +++ b/bookwyrm/templates/snippets/status/headers/comment.html @@ -18,8 +18,6 @@ commented on {{ book }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/quotation.html b/bookwyrm/templates/snippets/status/headers/quotation.html index 3ddd20291..ce0ea5923 100644 --- a/bookwyrm/templates/snippets/status/headers/quotation.html +++ b/bookwyrm/templates/snippets/status/headers/quotation.html @@ -18,8 +18,6 @@ quoted {{ book }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/read.html b/bookwyrm/templates/snippets/status/headers/read.html index 8c323dac6..5a237a836 100644 --- a/bookwyrm/templates/snippets/status/headers/read.html +++ b/bookwyrm/templates/snippets/status/headers/read.html @@ -20,8 +20,6 @@ finished reading {{ book }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/reading.html b/bookwyrm/templates/snippets/status/headers/reading.html index 73e96ebbc..44c604620 100644 --- a/bookwyrm/templates/snippets/status/headers/reading.html +++ b/bookwyrm/templates/snippets/status/headers/reading.html @@ -20,8 +20,6 @@ started reading {{ book }} {% endif %} -{% if book.series %} -({{book.series}} {%if book.series_number %}#{{book.series_number}}) {% endif %} -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/review.html b/bookwyrm/templates/snippets/status/headers/review.html index 0bdcd29b1..95a6fc403 100644 --- a/bookwyrm/templates/snippets/status/headers/review.html +++ b/bookwyrm/templates/snippets/status/headers/review.html @@ -18,8 +18,6 @@ reviewed {{ book }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/stopped_reading.html b/bookwyrm/templates/snippets/status/headers/stopped_reading.html index a00be181c..09f2e4264 100644 --- a/bookwyrm/templates/snippets/status/headers/stopped_reading.html +++ b/bookwyrm/templates/snippets/status/headers/stopped_reading.html @@ -20,9 +20,7 @@ stopped reading {{ book }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/to_read.html b/bookwyrm/templates/snippets/status/headers/to_read.html index 4d1b2ab1b..c775c33a7 100644 --- a/bookwyrm/templates/snippets/status/headers/to_read.html +++ b/bookwyrm/templates/snippets/status/headers/to_read.html @@ -20,8 +20,6 @@ wants to read {{ book }} {% endif %} -{% if book.series %} -({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) -{% endif %} +{% include 'snippets/book_series.html' with book=book %} {% endspaceless %}