From 21a954c7dfe4355b4a8352ada7ced811e9733638 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 8 Aug 2021 18:40:47 -0700 Subject: [PATCH] Always use underscores in html ids Plus some other shifting around --- bookwyrm/activitypub/base_activity.py | 2 +- bookwyrm/static/js/bookwyrm.js | 4 +- bookwyrm/templates/book/book.html | 20 +-- bookwyrm/templates/book/readthrough.html | 16 +-- bookwyrm/templates/components/dropdown.html | 8 +- .../templates/components/inline_form.html | 2 +- bookwyrm/templates/components/modal.html | 8 +- bookwyrm/templates/compose.html | 2 +- .../confirm_email/confirm_email.html | 4 +- bookwyrm/templates/directory/directory.html | 4 +- bookwyrm/templates/feed/direct_messages.html | 2 +- bookwyrm/templates/feed/layout.html | 8 +- bookwyrm/templates/get_started/layout.html | 4 +- bookwyrm/templates/goal.html | 8 +- bookwyrm/templates/import_status.html | 4 +- bookwyrm/templates/layout.html | 6 +- bookwyrm/templates/lists/list.html | 2 +- bookwyrm/templates/lists/list_layout.html | 6 +- bookwyrm/templates/lists/lists.html | 4 +- .../templates/reading_progress/finish.html | 2 +- .../templates/reading_progress/start.html | 2 +- bookwyrm/templates/reading_progress/want.html | 2 +- bookwyrm/templates/rss/title.html | 17 +-- bookwyrm/templates/search/book.html | 6 +- bookwyrm/templates/settings/announcement.html | 4 +- .../templates/settings/announcements.html | 4 +- .../templates/settings/federated_server.html | 8 +- bookwyrm/templates/settings/site.html | 2 +- bookwyrm/templates/snippets/announcement.html | 6 +- bookwyrm/templates/snippets/boost_button.html | 8 +- .../templates/snippets/create_status.html | 24 ++-- .../snippets/create_status/comment.html | 49 +++++++ .../snippets/create_status/content_field.html | 19 +++ .../content_warning_field.html | 6 +- .../create_status/content_warning_toggle.html | 8 ++ .../snippets/create_status/direct.html | 7 + .../snippets/create_status/layout.html | 57 ++++++++ .../create_status/post_options_block.html | 22 +++ .../snippets/create_status/quotation.html | 34 +++++ .../snippets/create_status/reply.html | 10 ++ .../snippets/create_status/review.html | 35 +++++ .../snippets/create_status/status.html | 2 + .../snippets/create_status_form.html | 131 ------------------ .../snippets/delete_readthrough_modal.html | 2 +- bookwyrm/templates/snippets/fav_button.html | 4 +- .../templates/snippets/follow_button.html | 4 +- .../templates/snippets/form_rate_stars.html | 8 +- .../snippets/generated_status/goal.html | 7 +- .../snippets/generated_status/rating.html | 8 +- bookwyrm/templates/snippets/goal_form.html | 2 +- .../templates/snippets/privacy_select.html | 4 +- .../templates/snippets/readthrough_form.html | 12 +- .../templates/snippets/report_button.html | 2 +- .../snippets/shelve_button/shelve_button.html | 8 +- .../shelve_button/shelve_button_options.html | 8 +- bookwyrm/templates/snippets/stars.html | 2 +- .../status/{status_body.html => body.html} | 2 +- .../snippets/status/content_status.html | 8 +- .../templates/snippets/status/header.html | 48 +++++++ .../snippets/status/header_content.html | 4 + .../snippets/status/headers/comment.html | 2 + .../snippets/status/headers/goal.html | 5 + .../snippets/status/headers/note.html | 22 +++ .../snippets/status/headers/quotation.html | 2 + .../snippets/status/headers/rating.html | 25 ++++ .../snippets/status/headers/read.html | 7 + .../snippets/status/headers/reading.html | 9 ++ .../snippets/status/headers/review.html | 3 + .../snippets/status/headers/to_read.html | 8 ++ .../templates/snippets/status/layout.html | 13 +- .../templates/snippets/status/status.html | 4 +- .../snippets/status/status_header.html | 109 --------------- .../snippets/toggle/toggle_button.html | 6 +- bookwyrm/templates/snippets/trimmed_text.html | 6 +- bookwyrm/templates/user/lists.html | 6 +- bookwyrm/templates/user/shelf/shelf.html | 10 +- bookwyrm/templates/user/user.html | 2 +- bookwyrm/templatetags/status_display.py | 13 +- 78 files changed, 555 insertions(+), 409 deletions(-) create mode 100644 bookwyrm/templates/snippets/create_status/comment.html create mode 100644 bookwyrm/templates/snippets/create_status/content_field.html rename bookwyrm/templates/snippets/{ => create_status}/content_warning_field.html (69%) create mode 100644 bookwyrm/templates/snippets/create_status/content_warning_toggle.html create mode 100644 bookwyrm/templates/snippets/create_status/direct.html create mode 100644 bookwyrm/templates/snippets/create_status/layout.html create mode 100644 bookwyrm/templates/snippets/create_status/post_options_block.html create mode 100644 bookwyrm/templates/snippets/create_status/quotation.html create mode 100644 bookwyrm/templates/snippets/create_status/reply.html create mode 100644 bookwyrm/templates/snippets/create_status/review.html create mode 100644 bookwyrm/templates/snippets/create_status/status.html delete mode 100644 bookwyrm/templates/snippets/create_status_form.html rename bookwyrm/templates/snippets/status/{status_body.html => body.html} (93%) create mode 100644 bookwyrm/templates/snippets/status/header.html create mode 100644 bookwyrm/templates/snippets/status/header_content.html create mode 100644 bookwyrm/templates/snippets/status/headers/comment.html create mode 100644 bookwyrm/templates/snippets/status/headers/goal.html create mode 100644 bookwyrm/templates/snippets/status/headers/note.html create mode 100644 bookwyrm/templates/snippets/status/headers/quotation.html create mode 100644 bookwyrm/templates/snippets/status/headers/rating.html create mode 100644 bookwyrm/templates/snippets/status/headers/read.html create mode 100644 bookwyrm/templates/snippets/status/headers/reading.html create mode 100644 bookwyrm/templates/snippets/status/headers/review.html create mode 100644 bookwyrm/templates/snippets/status/headers/to_read.html delete mode 100644 bookwyrm/templates/snippets/status/status_header.html diff --git a/bookwyrm/activitypub/base_activity.py b/bookwyrm/activitypub/base_activity.py index da32fbaf1..ddd45426f 100644 --- a/bookwyrm/activitypub/base_activity.py +++ b/bookwyrm/activitypub/base_activity.py @@ -48,7 +48,7 @@ class Signature: def naive_parse(activity_objects, activity_json, serializer=None): - """this navigates circular import issues""" + """this navigates circular import issues by looking up models' serializers""" if not serializer: if activity_json.get("publicKeyPem"): # ugh diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index e43ed134b..a4002c2d3 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -164,7 +164,7 @@ let BookWyrm = new class { } // Show/hide container. - let container = document.getElementById('hide-' + targetId); + let container = document.getElementById('hide_' + targetId); if (container) { this.toggleContainer(container, pressed); @@ -219,7 +219,7 @@ let BookWyrm = new class { /** * Check or uncheck a checbox. * - * @param {object} checkbox - DOM node + * @param {string} checkbox - id of the checkbox * @param {boolean} pressed - Is the trigger pressed? * @return {undefined} */ diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index c5dab1097..2e8ff0d04 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -72,8 +72,8 @@ {% if user_authenticated and not book.cover %}
{% trans "Add cover" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="add-cover" controls_uid=book.id focus="modal-title-add-cover" class="is-small" %} - {% include 'book/cover_modal.html' with book=book controls_text="add-cover" controls_uid=book.id %} + {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="add_cover" controls_uid=book.id focus="modal_title_add_cover" class="is-small" %} + {% include 'book/cover_modal.html' with book=book controls_text="add_cover" controls_uid=book.id %} {% if request.GET.cover_error %}

{% trans "Failed to load cover" %}

{% endif %} @@ -128,19 +128,19 @@ {% if user_authenticated and can_edit_book and not book|book_description %} {% trans 'Add Description' as button_text %} - {% include 'snippets/toggle/open_button.html' with text=button_text controls_text="add-description" controls_uid=book.id focus="id_description" hide_active=True id="hide-description" %} + {% include 'snippets/toggle/open_button.html' with text=button_text controls_text="add_description" controls_uid=book.id focus="id_description" hide_active=True id="hide_description" %} -
{% trans "Add read dates" as button_text %} - {% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="plus" class="is-small" controls_text="add-readthrough" focus="add-readthrough-focus" %} + {% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="plus" class="is-small" controls_text="add_readthrough" focus="add_readthrough_focus_" %}
-
diff --git a/bookwyrm/templates/book/readthrough.html b/bookwyrm/templates/book/readthrough.html index 751407461..05ed3c639 100644 --- a/bookwyrm/templates/book/readthrough.html +++ b/bookwyrm/templates/book/readthrough.html @@ -2,7 +2,7 @@ {% load humanize %} {% load tz %}
-
+
{% trans "Progress Updates:" %} @@ -24,7 +24,7 @@ {% if readthrough.progress %} {% trans "Show all updates" as button_text %} {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="updates" controls_uid=readthrough.id class="is-small" %} -
@@ -69,15 +69,15 @@
-