From 629acbaa193fa2b4a22593fd31a2e31f3bb8c3ff Mon Sep 17 00:00:00 2001 From: Braden Solt Date: Sat, 27 Jan 2024 10:58:57 -0700 Subject: [PATCH 1/4] add series number on posts in the feed --- bookwyrm/templates/snippets/book_titleby.html | 9 ++++++++- bookwyrm/templates/snippets/status/headers/comment.html | 4 ++++ .../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 | 5 +++++ 8 files changed, 37 insertions(+), 1 deletion(-) diff --git a/bookwyrm/templates/snippets/book_titleby.html b/bookwyrm/templates/snippets/book_titleby.html index dc42bf273..35e0c4c45 100644 --- a/bookwyrm/templates/snippets/book_titleby.html +++ b/bookwyrm/templates/snippets/book_titleby.html @@ -9,12 +9,19 @@ {% if book.authors.exists %} {% blocktrans trimmed with path=book.local_path title=book|book_title %} -{{ title }} by +{{ title }} + +by {% endblocktrans %} {% include 'snippets/authors.html' with book=book limit=3 %} {% else %} {{ book|book_title }} {% endif %} +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + + {% endcache %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/comment.html b/bookwyrm/templates/snippets/status/headers/comment.html index e3e2ec40b..b78175bb0 100644 --- a/bookwyrm/templates/snippets/status/headers/comment.html +++ b/bookwyrm/templates/snippets/status/headers/comment.html @@ -16,5 +16,9 @@ commented on {{ book }} by {{ book }} {% endblocktrans %} +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + {% endif %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/quotation.html b/bookwyrm/templates/snippets/status/headers/quotation.html index 2cdd5a991..8a6776303 100644 --- a/bookwyrm/templates/snippets/status/headers/quotation.html +++ b/bookwyrm/templates/snippets/status/headers/quotation.html @@ -16,5 +16,9 @@ quoted {{ book }} by { quoted {{ book }} {% endblocktrans %} +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + {% endif %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/read.html b/bookwyrm/templates/snippets/status/headers/read.html index a59a3544e..aaebbd267 100644 --- a/bookwyrm/templates/snippets/status/headers/read.html +++ b/bookwyrm/templates/snippets/status/headers/read.html @@ -18,5 +18,9 @@ finished reading {{ book }} by {{ book }} {% endblocktrans %} +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + {% endif %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/reading.html b/bookwyrm/templates/snippets/status/headers/reading.html index 886158f29..f773775e0 100644 --- a/bookwyrm/templates/snippets/status/headers/reading.html +++ b/bookwyrm/templates/snippets/status/headers/reading.html @@ -12,6 +12,10 @@ started reading {{ book }} by {{ book }} by {{ book }} {% endblocktrans %} +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + {% endif %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/stopped_reading.html b/bookwyrm/templates/snippets/status/headers/stopped_reading.html index 3b6a314e1..d3891cb78 100644 --- a/bookwyrm/templates/snippets/status/headers/stopped_reading.html +++ b/bookwyrm/templates/snippets/status/headers/stopped_reading.html @@ -18,6 +18,10 @@ stopped reading {{ book }} by {{ book }} {% endblocktrans %} +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + {% endif %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/to_read.html b/bookwyrm/templates/snippets/status/headers/to_read.html index 2abdde17b..4d1b2ab1b 100644 --- a/bookwyrm/templates/snippets/status/headers/to_read.html +++ b/bookwyrm/templates/snippets/status/headers/to_read.html @@ -19,4 +19,9 @@ wants to read {{ book }} {% endblocktrans %} {% endif %} + +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} + {% endspaceless %} From 6add81cf158405bdab718bba8378d3485cacb77d Mon Sep 17 00:00:00 2001 From: Braden Solt Date: Sat, 27 Jan 2024 11:02:42 -0700 Subject: [PATCH 2/4] move outside of authors "if" --- bookwyrm/templates/snippets/status/headers/comment.html | 3 ++- .../templates/snippets/status/headers/quotation.html | 3 ++- bookwyrm/templates/snippets/status/headers/read.html | 3 ++- bookwyrm/templates/snippets/status/headers/reading.html | 9 +++++---- bookwyrm/templates/snippets/status/headers/review.html | 3 ++- .../snippets/status/headers/stopped_reading.html | 3 ++- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bookwyrm/templates/snippets/status/headers/comment.html b/bookwyrm/templates/snippets/status/headers/comment.html index b78175bb0..b7750d3df 100644 --- a/bookwyrm/templates/snippets/status/headers/comment.html +++ b/bookwyrm/templates/snippets/status/headers/comment.html @@ -16,9 +16,10 @@ commented on {{ book }} by {{ book }} {% endblocktrans %} +{% endif %} + {% if book.series %} ({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) {% endif %} -{% endif %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/quotation.html b/bookwyrm/templates/snippets/status/headers/quotation.html index 8a6776303..3ddd20291 100644 --- a/bookwyrm/templates/snippets/status/headers/quotation.html +++ b/bookwyrm/templates/snippets/status/headers/quotation.html @@ -16,9 +16,10 @@ quoted {{ book }} by { quoted {{ book }} {% endblocktrans %} +{% endif %} + {% if book.series %} ({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) {% endif %} -{% endif %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/read.html b/bookwyrm/templates/snippets/status/headers/read.html index aaebbd267..8c323dac6 100644 --- a/bookwyrm/templates/snippets/status/headers/read.html +++ b/bookwyrm/templates/snippets/status/headers/read.html @@ -18,9 +18,10 @@ finished reading {{ book }} by {{ book }} {% endblocktrans %} +{% endif %} + {% if book.series %} ({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) {% endif %} -{% endif %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/reading.html b/bookwyrm/templates/snippets/status/headers/reading.html index f773775e0..73e96ebbc 100644 --- a/bookwyrm/templates/snippets/status/headers/reading.html +++ b/bookwyrm/templates/snippets/status/headers/reading.html @@ -12,10 +12,6 @@ started reading {{ book }} by {{ book }} {% endblocktrans %} {% endif %} + +{% if book.series %} +({{book.series}} {%if book.series_number %}#{{book.series_number}}) {% endif %} +{% endif %} + {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/review.html b/bookwyrm/templates/snippets/status/headers/review.html index 371d8b2cb..0bdcd29b1 100644 --- a/bookwyrm/templates/snippets/status/headers/review.html +++ b/bookwyrm/templates/snippets/status/headers/review.html @@ -16,9 +16,10 @@ reviewed {{ book }} by {{ book }} {% endblocktrans %} +{% endif %} + {% if book.series %} ({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) {% endif %} -{% endif %} {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/stopped_reading.html b/bookwyrm/templates/snippets/status/headers/stopped_reading.html index d3891cb78..a00be181c 100644 --- a/bookwyrm/templates/snippets/status/headers/stopped_reading.html +++ b/bookwyrm/templates/snippets/status/headers/stopped_reading.html @@ -18,10 +18,11 @@ stopped reading {{ book }} by {{ book }} {% endblocktrans %} +{% endif %} + {% if book.series %} ({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) {% endif %} -{% endif %} {% endspaceless %} From 2d2ccd51df4801d2219ad46c2d7bff99d9afc6c3 Mon Sep 17 00:00:00 2001 From: Bart Schuurmans Date: Sat, 23 Mar 2024 19:35:24 +0100 Subject: [PATCH 3/4] 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 %} From 592914dc91aad1a2a96c90321eef1006a9d4a060 Mon Sep 17 00:00:00 2001 From: Bart Schuurmans Date: Sat, 23 Mar 2024 19:51:20 +0100 Subject: [PATCH 4/4] Render series number with comma and outside of link on book page --- bookwyrm/templates/book/book.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index 4c345832e..83500a54b 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -45,18 +45,22 @@ {% endif %} {% if book.series %} - + {% spaceless %} {% if book.authors.exists %} {% endif %} + {% if book.series_number %} + , # + {{ book.series_number }} + {% endif %} + {% endspaceless %} {% endif %}

{% endif %}