From 978760475f5140f61f8f3dd7c3a7a0b454fa412c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 20 Apr 2021 09:54:02 -0700 Subject: [PATCH] More compact display of statuses --- .../snippets/status/book_preview.html | 14 -- .../snippets/status/content_status.html | 126 ++++++++++++++++ .../snippets/status/generated_status.html | 43 ++++++ .../templates/snippets/status/layout.html | 86 +++++++++++ .../snippets/status/status_body.html | 89 +----------- .../snippets/status/status_content.html | 137 ------------------ 6 files changed, 261 insertions(+), 234 deletions(-) delete mode 100644 bookwyrm/templates/snippets/status/book_preview.html create mode 100644 bookwyrm/templates/snippets/status/content_status.html create mode 100644 bookwyrm/templates/snippets/status/generated_status.html create mode 100644 bookwyrm/templates/snippets/status/layout.html delete mode 100644 bookwyrm/templates/snippets/status/status_content.html diff --git a/bookwyrm/templates/snippets/status/book_preview.html b/bookwyrm/templates/snippets/status/book_preview.html deleted file mode 100644 index 920b9f538..000000000 --- a/bookwyrm/templates/snippets/status/book_preview.html +++ /dev/null @@ -1,14 +0,0 @@ -{% load bookwyrm_tags %} -
-
-
- {% include 'snippets/book_cover.html' with book=book %} - {% include 'snippets/stars.html' with rating=book|rating:request.user %} - {% include 'snippets/shelve_button/shelve_button.html' with book=book %} -
-
-
-

{% include 'snippets/book_titleby.html' with book=book %}

- {% include 'snippets/trimmed_text.html' with full=book|book_description %} -
-
diff --git a/bookwyrm/templates/snippets/status/content_status.html b/bookwyrm/templates/snippets/status/content_status.html new file mode 100644 index 000000000..05662098c --- /dev/null +++ b/bookwyrm/templates/snippets/status/content_status.html @@ -0,0 +1,126 @@ +{% spaceless %} + +{% load bookwyrm_tags %} +{% load i18n %} + +{% with status_type=status.status_type %} +
+ +
+ {% if not hide_book %} + {% with book=status.book|default:status.mention_books.first %} +
+
+ {% include 'snippets/book_cover.html' with book=book %} + {% include 'snippets/stars.html' with rating=book|rating:request.user %} + {% include 'snippets/shelve_button/shelve_button.html' with book=book %} +
+
+ {% endwith %} + {% endif %} + +
+ {% if status_type == 'Review' %} +
+

+ {{ status.name|escape }} +

+ +

+ + {% include 'snippets/stars.html' with rating=status.rating %} +

+
+ {% endif %} + + {% if status.content_warning %} +
+

{{ status.content_warning }}

+ + {% trans "Show more" as button_text %} + + {% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %} + {% include 'snippets/toggle/open_button.html' %} + {% endwith %} +
+ {% endif %} + + +
+
+ +{% endwith %} +{% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/generated_status.html b/bookwyrm/templates/snippets/status/generated_status.html new file mode 100644 index 000000000..f4186cd10 --- /dev/null +++ b/bookwyrm/templates/snippets/status/generated_status.html @@ -0,0 +1,43 @@ +{% spaceless %} + +{% load bookwyrm_tags %} +{% load i18n %} + +{% if status_type == 'Rating' %} +
+
+ + + + {# @todo Is it possible to not hard-code the value? #} + + + + {% include 'snippets/stars.html' with rating=status.rating %} +
+
+{% endif %} + +{% if not hide_book %} +{% with book=status.book|default:status.mention_books.first %} +
+ +
+

{% include 'snippets/book_titleby.html' with book=book %}

+

{{ book|book_description|default:""|truncatewords_html:20 }}

+ {% include 'snippets/shelve_button/shelve_button.html' with book=book %} +
+
+{% endwith %} +{% endif %} + +{% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/layout.html b/bookwyrm/templates/snippets/status/layout.html new file mode 100644 index 000000000..5b6c0c78d --- /dev/null +++ b/bookwyrm/templates/snippets/status/layout.html @@ -0,0 +1,86 @@ +{% extends 'components/card.html' %} +{% load i18n %} + +{% load bookwyrm_tags %} +{% load humanize %} + +{% block card-header %} +

+ {% include 'snippets/status/status_header.html' with status=status %} +

+{% endblock %} + +{% block card-content %}{% endblock %} + +{% block card-footer %} + + + + + +{% if not moderation_mode %} + +{% endif %} +{% endblock %} + + +{% block card-bonus %} +{% if request.user.is_authenticated and not moderation_mode %} +{% with status.id|uuid as uuid %} + +{% endwith %} +{% endif %} +{% endblock %} diff --git a/bookwyrm/templates/snippets/status/status_body.html b/bookwyrm/templates/snippets/status/status_body.html index ffa71d5e1..58d3fbf4e 100644 --- a/bookwyrm/templates/snippets/status/status_body.html +++ b/bookwyrm/templates/snippets/status/status_body.html @@ -1,90 +1,13 @@ -{% extends 'components/card.html' %} -{% load i18n %} - -{% load bookwyrm_tags %} -{% load humanize %} - -{% block card-header %} -

- {% include 'snippets/status/status_header.html' with status=status %} -

-{% endblock %} - +{% extends 'snippets/status/layout.html' %} {% block card-content %} - {% include 'snippets/status/status_content.html' with status=status %} -{% endblock %} +{% with status_type=status.status_type %} - -{% block card-footer %} - - - - - -{% if not moderation_mode %} - +{% if status_type == 'GeneratedNote' or status_type == 'Rating' %} + {% include 'snippets/status/generated_status.html' with status=status %} +{% else %} + {% include 'snippets/status/content_status.html' with status=status %} {% endif %} -{% endblock %} - -{% block card-bonus %} -{% if request.user.is_authenticated and not moderation_mode %} -{% with status.id|uuid as uuid %} - {% endwith %} -{% endif %} {% endblock %} diff --git a/bookwyrm/templates/snippets/status/status_content.html b/bookwyrm/templates/snippets/status/status_content.html deleted file mode 100644 index 402c4aabd..000000000 --- a/bookwyrm/templates/snippets/status/status_content.html +++ /dev/null @@ -1,137 +0,0 @@ -{% spaceless %} - -{% load bookwyrm_tags %} -{% load i18n %} - -{% with status_type=status.status_type %} -
- {% if status_type == 'Review' or status_type == 'Rating' %} -
- {% if status.name %} -

- {{ status.name|escape }} -

- {% endif %} - - - - - {% if status_type == 'Rating' %} - {# @todo Is it possible to not hard-code the value? #} - - {% endif %} - - - {% include 'snippets/stars.html' with rating=status.rating %} -
- {% endif %} - - {% if status.content_warning %} -
-

{{ status.content_warning }}

- - {% trans "Show more" as button_text %} - - {% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %} - {% include 'snippets/toggle/open_button.html' %} - {% endwith %} -
- {% endif %} - - -
- -{% if not hide_book %} - {% if status.book or status.mention_books.count %} -
- {% if status.book %} - {% with book=status.book %} - {% include 'snippets/status/book_preview.html' %} - {% endwith %} - {% elif status.mention_books.count %} - {% with book=status.mention_books.first %} - {% include 'snippets/status/book_preview.html' %} - {% endwith %} - {% endif %} -
- {% endif %} -{% endif %} -{% endwith %} -{% endspaceless %}