diff --git a/.github/workflows/curlylint.yaml b/.github/workflows/curlylint.yaml index e27d0b1b..593a4283 100644 --- a/.github/workflows/curlylint.yaml +++ b/.github/workflows/curlylint.yaml @@ -24,5 +24,5 @@ jobs: --rule 'meta_viewport: true' \ --rule 'no_autofocus: true' \ --rule 'tabindex_no_positive: true' \ - --exclude '_modal.html|create_status/layout.html' \ + --exclude '_modal.html|create_status/layout.html|reading_modals/layout.html' \ bookwyrm/templates diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index fc94c7de..36241ee2 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -203,7 +203,9 @@
+ {% with 0|uuid as controls_uid %} {% include 'snippets/create_status.html' with book=book hide_cover=True %} + {% endwith %}
{% endif %}
diff --git a/bookwyrm/templates/book/book_identifiers.html b/bookwyrm/templates/book/book_identifiers.html index 6021d243..8c8313f3 100644 --- a/bookwyrm/templates/book/book_identifiers.html +++ b/bookwyrm/templates/book/book_identifiers.html @@ -1,6 +1,7 @@ {% spaceless %} {% load i18n %} +{% if book.isbn13 or book.oclc_number or book.asin %}
{% if book.isbn_13 %}
@@ -23,4 +24,5 @@
{% endif %}
+{% endif %} {% endspaceless %} diff --git a/bookwyrm/templates/book/edit/edit_book.html b/bookwyrm/templates/book/edit/edit_book.html new file mode 100644 index 00000000..ec7b0858 --- /dev/null +++ b/bookwyrm/templates/book/edit/edit_book.html @@ -0,0 +1,116 @@ +{% extends 'layout.html' %} +{% load i18n %} +{% load humanize %} + +{% block title %}{% if book %}{% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %}{% else %}{% trans "Add Book" %}{% endif %}{% endblock %} + +{% block content %} +
+

+ {% if book %} + {% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %} + {% else %} + {% trans "Add Book" %} + {% endif %} +

+ {% if book %} +
+
{% trans "Added:" %}
+
{{ book.created_date | naturaltime }}
+ +
{% trans "Updated:" %}
+
{{ book.updated_date | naturaltime }}
+ + {% if book.last_edited_by %} +
{% trans "Last edited by:" %}
+
{{ book.last_edited_by.display_name }}
+ {% endif %} + +
+ {% endif %} +
+ +
+ {% if confirm_mode %} +
+

{% trans "Confirm Book Info" %}

+
+ {% if author_matches %} + +
+ {% for author in author_matches %} +
+ + {% blocktrans with name=author.name %}Is "{{ name }}" an existing author?{% endblocktrans %} + + {% with forloop.counter0 as counter %} + {% for match in author.matches %} + +

+ {% blocktrans with book_title=match.book_set.first.title %}Author of {{ book_title }}{% endblocktrans %} +

+ {% endfor %} + + {% endwith %} +
+ {% endfor %} +
+ {% else %} +

{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% endblocktrans %}

+ {% endif %} + + {% if not book %} +
+
+ + {% trans "Is this an edition of an existing work?" %} + + {% for match in book_matches %} + + {% endfor %} + +
+
+ {% endif %} +
+ + + + {% trans "Back" %} + +
+ +
+ {% endif %} + + {% include "book/edit/edit_book_form.html" %} + + {% if not confirm_mode %} +
+ + {% trans "Cancel" %} +
+ {% endif %} +
+ +{% endblock %} diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit/edit_book_form.html similarity index 59% rename from bookwyrm/templates/book/edit_book.html rename to bookwyrm/templates/book/edit/edit_book_form.html index 5a859e3d..982bb56d 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit/edit_book_form.html @@ -1,40 +1,4 @@ -{% extends 'layout.html' %} {% load i18n %} -{% load humanize %} - -{% block title %}{% if book %}{% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %}{% else %}{% trans "Add Book" %}{% endif %}{% endblock %} - -{% block content %} -
-

- {% if book %} - {% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %} - {% else %} - {% trans "Add Book" %} - {% endif %} -

- {% if book %} -
-
-
{% trans "Added:" %}
-
{{ book.created_date | naturaltime }}
-
- -
-
{% trans "Updated:" %}
-
{{ book.updated_date | naturaltime }}
-
- - {% if book.last_edited_by %} -
-
{% trans "Last edited by:" %}
-
{{ book.last_edited_by.display_name }}
-
- {% endif %} - -
- {% endif %} -
{% if form.non_field_errors %}
@@ -42,87 +6,14 @@
{% endif %} -
- - {% csrf_token %} - {% if confirm_mode %} -
-

{% trans "Confirm Book Info" %}

-
- {% if author_matches %} - -
- {% for author in author_matches %} -
- - {% blocktrans with name=author.name %}Is "{{ name }}" an existing author?{% endblocktrans %} - - {% with forloop.counter0 as counter %} - {% for match in author.matches %} - -

- {% blocktrans with book_title=match.book_set.first.title %}Author of {{ book_title }}{% endblocktrans %} -

- {% endfor %} - - {% endwith %} -
- {% endfor %} -
- {% else %} -

{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% endblocktrans %}

- {% endif %} - - {% if not book %} -
-
- - {% trans "Is this an edition of an existing work?" %} - - {% for match in book_matches %} - - {% endfor %} - -
-
- {% endif %} -
- - - - {% trans "Back" %} - -
- -
- {% endif %} - - -
-
-
-

{% trans "Metadata" %}

+{% csrf_token %} + +
+
+
+

{% trans "Metadata" %}

+
@@ -147,20 +38,25 @@ {% endfor %}
-
- - - {% for error in form.series.errors %} -

{{ error | escape }}

- {% endfor %} -
- -
- - {{ form.series_number }} - {% for error in form.series_number.errors %} -

{{ error | escape }}

- {% endfor %} +
+
+
+ + + {% for error in form.series.errors %} +

{{ error | escape }}

+ {% endfor %} +
+
+
+
+ + {{ form.series_number }} + {% for error in form.series_number.errors %} +

{{ error | escape }}

+ {% endfor %} +
+
@@ -171,7 +67,12 @@

{{ error | escape }}

{% endfor %}
+
+
+
+

{% trans "Publication" %}

+
{{ form.publishers }} @@ -196,10 +97,12 @@

{{ error | escape }}

{% endfor %}
-
+
+
-
-

{% trans "Authors" %}

+
+

{% trans "Authors" %}

+
{% if book.authors.exists %}
{% for author in book.authors.all %} @@ -220,18 +123,22 @@ {% trans "Separate multiple values with commas." %}
-
-
+
+ +
-
+
+

{% trans "Cover" %}

-
-
- {% include 'snippets/book_cover.html' with book=book cover_class='is-h-xl-mobile is-w-auto-tablet' size_mobile='xlarge' size='large' %} -
+
+
+ {% if book.cover %} +
+ {% include 'snippets/book_cover.html' with book=book cover_class='is-h-xl-mobile is-w-auto-tablet' size_mobile='xlarge' size='large' %} +
+ {% endif %} -
-
+
{{ form.cover }} @@ -248,9 +155,11 @@
+
-
-

{% trans "Physical Properties" %}

+
+

{% trans "Physical Properties" %}

+
@@ -282,9 +191,11 @@ {% endfor %}
+
-
-

{% trans "Book Identifiers" %}

+
+

{% trans "Book Identifiers" %}

+
{{ form.isbn_13 }} @@ -333,15 +244,6 @@ {% endfor %}
-
+
- - {% if not confirm_mode %} -
- - {% trans "Cancel" %} -
- {% endif %} - - -{% endblock %} +
diff --git a/bookwyrm/templates/book/edition_filters.html b/bookwyrm/templates/book/edition_filters.html deleted file mode 100644 index c41ab0c0..00000000 --- a/bookwyrm/templates/book/edition_filters.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'snippets/filters_panel/filters_panel.html' %} - -{% block filter_fields %} -{% include 'book/search_filter.html' %} -{% include 'book/language_filter.html' %} -{% include 'book/format_filter.html' %} -{% endblock %} diff --git a/bookwyrm/templates/book/editions/edition_filters.html b/bookwyrm/templates/book/editions/edition_filters.html new file mode 100644 index 00000000..c6702a5c --- /dev/null +++ b/bookwyrm/templates/book/editions/edition_filters.html @@ -0,0 +1,7 @@ +{% extends 'snippets/filters_panel/filters_panel.html' %} + +{% block filter_fields %} +{% include 'book/editions/search_filter.html' %} +{% include 'book/editions/language_filter.html' %} +{% include 'book/editions/format_filter.html' %} +{% endblock %} diff --git a/bookwyrm/templates/book/editions.html b/bookwyrm/templates/book/editions/editions.html similarity index 97% rename from bookwyrm/templates/book/editions.html rename to bookwyrm/templates/book/editions/editions.html index 7a4338f1..a3ff0802 100644 --- a/bookwyrm/templates/book/editions.html +++ b/bookwyrm/templates/book/editions/editions.html @@ -8,7 +8,7 @@

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

-{% include 'book/edition_filters.html' %} +{% include 'book/editions/edition_filters.html' %}
{% for book in editions %} diff --git a/bookwyrm/templates/book/format_filter.html b/bookwyrm/templates/book/editions/format_filter.html similarity index 100% rename from bookwyrm/templates/book/format_filter.html rename to bookwyrm/templates/book/editions/format_filter.html diff --git a/bookwyrm/templates/book/language_filter.html b/bookwyrm/templates/book/editions/language_filter.html similarity index 100% rename from bookwyrm/templates/book/language_filter.html rename to bookwyrm/templates/book/editions/language_filter.html diff --git a/bookwyrm/templates/book/search_filter.html b/bookwyrm/templates/book/editions/search_filter.html similarity index 100% rename from bookwyrm/templates/book/search_filter.html rename to bookwyrm/templates/book/editions/search_filter.html diff --git a/bookwyrm/templates/book/publisher_info.html b/bookwyrm/templates/book/publisher_info.html index 42cb4098..e0711fa8 100644 --- a/bookwyrm/templates/book/publisher_info.html +++ b/bookwyrm/templates/book/publisher_info.html @@ -3,31 +3,30 @@ {% load i18n %} {% load humanize %} +{% firstof book.physical_format_detail book.physical_format as format %} +{% firstof book.physical_format book.physical_format_detail as format_property %} +{% with pages=book.pages %} +{% if format or pages %} + +{% if format_property %} + +{% endif %} + +{% if pages %} + +{% endif %} +

- {% firstof book.physical_format_detail book.physical_format as format %} - {% firstof book.physical_format book.physical_format_detail as format_property %} - {% with pages=book.pages %} - {% if format %} - {% comment %} - @todo The bookFormat property is limited to a list of values whereas the book edition is free text. - @see https://schema.org/bookFormat - {% endcomment %} - - {% endif %} - - {% if pages %} - - {% endif %} - - {% if format and not pages %} - {% blocktrans %}{{ format }}{% endblocktrans %} - {% elif format and pages %} - {% blocktrans %}{{ format }}, {{ pages }} pages{% endblocktrans %} - {% elif pages %} - {% blocktrans %}{{ pages }} pages{% endblocktrans %} - {% endif %} - {% endwith %} + {% if format and not pages %} + {% blocktrans %}{{ format }}{% endblocktrans %} + {% elif format and pages %} + {% blocktrans %}{{ format }}, {{ pages }} pages{% endblocktrans %} + {% elif pages %} + {% blocktrans %}{{ pages }} pages{% endblocktrans %} + {% endif %}

+{% endif %} +{% endwith %} {% if book.languages %} {% for language in book.languages %} @@ -41,32 +40,34 @@

{% endif %} +{% with date=book.published_date|naturalday publisher=book.publishers|join:', ' %} +{% if date or book.first_published_date or book.publishers %} +{% if date or book.first_published_date %} + +{% endif %}

- {% with date=book.published_date|naturalday publisher=book.publishers|join:', ' %} - {% if date or book.first_published_date %} - - {% endif %} - {% comment %} - @todo The publisher property needs to be an Organization or a Person. We’ll be using Thing which is the more generic ancestor. - @see https://schema.org/Publisher - {% endcomment %} - {% if book.publishers %} - {% for publisher in book.publishers %} - - {% endfor %} - {% endif %} + {% comment %} + @todo The publisher property needs to be an Organization or a Person. We’ll be using Thing which is the more generic ancestor. + @see https://schema.org/Publisher + {% endcomment %} + {% if book.publishers %} + {% for publisher in book.publishers %} + + {% endfor %} + {% endif %} - {% if date and publisher %} - {% blocktrans %}Published {{ date }} by {{ publisher }}.{% endblocktrans %} - {% elif date %} - {% blocktrans %}Published {{ date }}{% endblocktrans %} - {% elif publisher %} - {% blocktrans %}Published by {{ publisher }}.{% endblocktrans %} - {% endif %} - {% endwith %} + {% if date and publisher %} + {% blocktrans %}Published {{ date }} by {{ publisher }}.{% endblocktrans %} + {% elif date %} + {% blocktrans %}Published {{ date }}{% endblocktrans %} + {% elif publisher %} + {% blocktrans %}Published by {{ publisher }}.{% endblocktrans %} + {% endif %}

+{% endif %} +{% endwith %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/create_status/content_field.html b/bookwyrm/templates/snippets/create_status/content_field.html index c2b383b9..c9afecc7 100644 --- a/bookwyrm/templates/snippets/create_status/content_field.html +++ b/bookwyrm/templates/snippets/create_status/content_field.html @@ -12,7 +12,7 @@ draft: an existing Status object that is providing default values for input fiel name="content" class="textarea save-draft" data-cache-draft="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}" - id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}" + id="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}{{ uuid }}" placeholder="{{ placeholder }}" aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans 'Content' %}{% endif %}" {% if not optional and type != "quotation" and type != "review" %}required{% endif %} diff --git a/bookwyrm/templates/snippets/create_status/layout.html b/bookwyrm/templates/snippets/create_status/layout.html index 1e10085c..4dded200 100644 --- a/bookwyrm/templates/snippets/create_status/layout.html +++ b/bookwyrm/templates/snippets/create_status/layout.html @@ -19,7 +19,7 @@ reply_parent: the Status object this post will be in reply to, if applicable name="{{ type }}" action="/post/{{ type }}" method="post" - id="tab_{{ type }}_{{ book.id }}{{ reply_parent.id }}" + id="form_{{ type }}_{{ book.id }}{{ reply_parent.id }}" > {% endblock %} @@ -36,7 +36,7 @@ reply_parent: the Status object this post will be in reply to, if applicable {# fields that go between the content warnings and the content field (ie, quote) #} {% block pre_content_additions %}{% endblock %} -
{% endblock %} + +{% block form %} +{% include "snippets/reading_modals/form.html" with optional=True type="finish_modal" %} +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/form.html b/bookwyrm/templates/snippets/reading_modals/form.html index 4a7ac3a5..e4ff5898 100644 --- a/bookwyrm/templates/snippets/reading_modals/form.html +++ b/bookwyrm/templates/snippets/reading_modals/form.html @@ -15,3 +15,5 @@ {% endblock %} + +{% block form_close %}{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/layout.html b/bookwyrm/templates/snippets/reading_modals/layout.html index 95010b37..89cc9a2e 100644 --- a/bookwyrm/templates/snippets/reading_modals/layout.html +++ b/bookwyrm/templates/snippets/reading_modals/layout.html @@ -23,10 +23,11 @@
- {% comparison_bool controls_text "progress_update" True as optional %} - {% include "snippets/reading_modals/form.html" with optional=optional %} + {% block form %}{% endblock %}
{% endwith %} {% endblock %} + +{% block modal-form-close %}{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/progress_update_modal.html b/bookwyrm/templates/snippets/reading_modals/progress_update_modal.html index 713dad8d..422f7056 100644 --- a/bookwyrm/templates/snippets/reading_modals/progress_update_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/progress_update_modal.html @@ -12,6 +12,10 @@ {% endblock %} {% block reading-dates %} - + {% include "snippets/progress_field.html" with progress_required=True %} {% endblock %} + +{% block form %} +{% include "snippets/reading_modals/form.html" with optional=False type="update_modal" %} +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html index 827c0a86..cd0b64f3 100644 --- a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html @@ -22,3 +22,7 @@ Start "{{ book_title }}" {% endblock %} + +{% block form %} +{% include "snippets/reading_modals/form.html" with optional=True type="start_modal" %} +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html b/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html index 5dec637b..d1f06d8f 100644 --- a/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html @@ -13,3 +13,7 @@ Want to Read "{{ book_title }}" {% csrf_token %} {% endblock %} + +{% block form %} +{% include "snippets/reading_modals/form.html" with optional=True type="want_modal" %} +{% endblock %} diff --git a/bookwyrm/templates/snippets/readthrough_form.html b/bookwyrm/templates/snippets/readthrough_form.html index 8810778c..a68306a3 100644 --- a/bookwyrm/templates/snippets/readthrough_form.html +++ b/bookwyrm/templates/snippets/readthrough_form.html @@ -10,7 +10,7 @@ {# Only show progress for editing existing readthroughs #} {% if readthrough.id and not readthrough.finish_date %} -