From ad3dc16005a046855798be4e7a595ad8e94082e3 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Jun 2021 13:18:23 +0000 Subject: [PATCH 01/30] Removrd Bio from Your books --- bookwyrm/templates/user/layout.html | 0 .../templates/user/layout_without_bio.html | 58 +++++++++++++++++++ bookwyrm/templates/user/lists.html | 0 bookwyrm/templates/user/shelf/shelf.html | 2 +- bookwyrm/templates/user/user.html | 0 bookwyrm/templates/user/user_preview.html | 0 6 files changed, 59 insertions(+), 1 deletion(-) mode change 100644 => 100755 bookwyrm/templates/user/layout.html create mode 100755 bookwyrm/templates/user/layout_without_bio.html mode change 100644 => 100755 bookwyrm/templates/user/lists.html mode change 100644 => 100755 bookwyrm/templates/user/user.html mode change 100644 => 100755 bookwyrm/templates/user/user_preview.html diff --git a/bookwyrm/templates/user/layout.html b/bookwyrm/templates/user/layout.html old mode 100644 new mode 100755 diff --git a/bookwyrm/templates/user/layout_without_bio.html b/bookwyrm/templates/user/layout_without_bio.html new file mode 100755 index 00000000..d76cdc7c --- /dev/null +++ b/bookwyrm/templates/user/layout_without_bio.html @@ -0,0 +1,58 @@ +{% extends 'layout.html' %} +{% load i18n %} +{% load humanize %} +{% load utilities %} +{% load markdown %} +{% load layout %} + +{% block title %}{{ user.display_name }}{% endblock %} + +{% block opengraph_images %} + {% include 'snippets/opengraph_images.html' with image=user.preview_image %} +{% endblock %} + +{% block content %} +
+ {% block header %} +

+ {% trans "User Profile" %} +

+ {% endblock %} +
+ + +{% block tabs %} +{% with user|username as username %} + +{% endwith %} +{% endblock %} + +{% block panel %}{% endblock %} + +{% endblock %} diff --git a/bookwyrm/templates/user/lists.html b/bookwyrm/templates/user/lists.html old mode 100644 new mode 100755 diff --git a/bookwyrm/templates/user/shelf/shelf.html b/bookwyrm/templates/user/shelf/shelf.html index 2163db8c..6f0babd4 100644 --- a/bookwyrm/templates/user/shelf/shelf.html +++ b/bookwyrm/templates/user/shelf/shelf.html @@ -1,4 +1,4 @@ -{% extends 'user/layout.html' %} +{% extends 'user/layout_without_bio.html' %} {% load bookwyrm_tags %} {% load utilities %} {% load humanize %} diff --git a/bookwyrm/templates/user/user.html b/bookwyrm/templates/user/user.html old mode 100644 new mode 100755 diff --git a/bookwyrm/templates/user/user_preview.html b/bookwyrm/templates/user/user_preview.html old mode 100644 new mode 100755 From 7e1b606e1fadd2d2ac671ebd615063d00a138d44 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 16 Aug 2021 11:08:13 -0700 Subject: [PATCH 02/30] Fixes link in status header for comments --- bookwyrm/templates/snippets/status/headers/comment.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/snippets/status/headers/comment.html b/bookwyrm/templates/snippets/status/headers/comment.html index 6886cfed..88ba30ca 100644 --- a/bookwyrm/templates/snippets/status/headers/comment.html +++ b/bookwyrm/templates/snippets/status/headers/comment.html @@ -1,2 +1,2 @@ {% load i18n %}{% load utilities %} -{% blocktrans with book_path=book.local_path book=status.book|book_title %}commented on {{ book }}{% endblocktrans %} +{% blocktrans with book_path=status.book.local_path book=status.book|book_title %}commented on {{ book }}{% endblocktrans %} From 257c9854c205224463ba0f518e06613a3896cc9b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 16 Aug 2021 11:30:11 -0700 Subject: [PATCH 03/30] Move reading modal templates to their own dir --- .../templates/reading_progress/finish.html | 2 +- .../templates/reading_progress/start.html | 2 +- bookwyrm/templates/reading_progress/want.html | 2 +- .../reading_modals/finish_reading_modal.html | 34 +++++++++++++ .../snippets/reading_modals/form.html | 9 ++++ .../snippets/reading_modals/layout.html | 26 ++++++++++ .../progress_update_modal.html | 0 .../reading_modals/start_reading_modal.html | 22 +++++++++ .../reading_modals/want_to_read_modal.html | 13 +++++ .../shelve_button/finish_reading_modal.html | 48 ------------------- .../snippets/shelve_button/shelve_button.html | 8 ++-- .../shelve_button/start_reading_modal.html | 42 ---------------- .../shelve_button/want_to_read_modal.html | 33 ------------- 13 files changed, 111 insertions(+), 130 deletions(-) create mode 100644 bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html create mode 100644 bookwyrm/templates/snippets/reading_modals/form.html create mode 100644 bookwyrm/templates/snippets/reading_modals/layout.html rename bookwyrm/templates/snippets/{shelve_button => reading_modals}/progress_update_modal.html (100%) create mode 100644 bookwyrm/templates/snippets/reading_modals/start_reading_modal.html create mode 100644 bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html delete mode 100644 bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html delete mode 100644 bookwyrm/templates/snippets/shelve_button/start_reading_modal.html delete mode 100644 bookwyrm/templates/snippets/shelve_button/want_to_read_modal.html diff --git a/bookwyrm/templates/reading_progress/finish.html b/bookwyrm/templates/reading_progress/finish.html index a9f60f04..ca69128e 100644 --- a/bookwyrm/templates/reading_progress/finish.html +++ b/bookwyrm/templates/reading_progress/finish.html @@ -9,6 +9,6 @@ Finish "{{ book_title }}" {% block content %} -{% include "snippets/shelve_button/finish_reading_modal.html" with book=book active=True %} +{% include "snippets/reading_modals/finish_reading_modal.html" with book=book active=True %} {% endblock %} diff --git a/bookwyrm/templates/reading_progress/start.html b/bookwyrm/templates/reading_progress/start.html index 9c457947..e24a0e05 100644 --- a/bookwyrm/templates/reading_progress/start.html +++ b/bookwyrm/templates/reading_progress/start.html @@ -9,6 +9,6 @@ Start "{{ book_title }}" {% block content %} -{% include "snippets/shelve_button/start_reading_modal.html" with book=book active=True %} +{% include "snippets/reading_modals/start_reading_modal.html" with book=book active=True %} {% endblock %} diff --git a/bookwyrm/templates/reading_progress/want.html b/bookwyrm/templates/reading_progress/want.html index e0353193..6122ade3 100644 --- a/bookwyrm/templates/reading_progress/want.html +++ b/bookwyrm/templates/reading_progress/want.html @@ -9,6 +9,6 @@ Want to Read "{{ book_title }}" {% block content %} -{% include "snippets/shelve_button/want_to_read_modal.html" with book=book active=True %} +{% include "snippets/reading_modals/want_to_read_modal.html" with book=book active=True %} {% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html new file mode 100644 index 00000000..fdb5d7bb --- /dev/null +++ b/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html @@ -0,0 +1,34 @@ +{% extends 'snippets/reading_modals/layout.html' %} +{% load i18n %} +{% load utilities %} + +{% block modal-title %} +{% blocktrans trimmed with book_title=book|book_title %} +Finish "{{ book_title }}" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} +
+{% endblock %} + +{% block reading-dates %} +
+
+
+ + +
+
+
+
+ + +
+
+
+{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/form.html b/bookwyrm/templates/snippets/reading_modals/form.html new file mode 100644 index 00000000..da2aad93 --- /dev/null +++ b/bookwyrm/templates/snippets/reading_modals/form.html @@ -0,0 +1,9 @@ +{% extends "snippets/create_status/layout.html" %} +{% load i18n %} + +{% block form_open %}{% endblock %} + +{% block initial_fields %} + + +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/layout.html b/bookwyrm/templates/snippets/reading_modals/layout.html new file mode 100644 index 00000000..877f14ef --- /dev/null +++ b/bookwyrm/templates/snippets/reading_modals/layout.html @@ -0,0 +1,26 @@ +{% extends 'components/modal.html' %} +{% load i18n %} +{% load utilities %} + +{% block modal-body %} + +{% block reading-dates %}{% endblock %} + +{% with 0|uuid as local_uuid %} +
+ + +
+ +
+ + {% include "snippets/reading_modals/form.html" %} +
+{% endwith %} + +{% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/progress_update_modal.html b/bookwyrm/templates/snippets/reading_modals/progress_update_modal.html similarity index 100% rename from bookwyrm/templates/snippets/shelve_button/progress_update_modal.html rename to bookwyrm/templates/snippets/reading_modals/progress_update_modal.html diff --git a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html new file mode 100644 index 00000000..08191c79 --- /dev/null +++ b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html @@ -0,0 +1,22 @@ +{% extends 'snippets/reading_modals/layout.html' %} +{% load i18n %} +{% load utilities %} + +{% block modal-title %} +{% blocktrans trimmed with book_title=book|book_title %} +Start "{{ book_title }}" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} + +{% endblock %} + +{% block reading-dates %} +
+ + +
+{% 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 new file mode 100644 index 00000000..5669610c --- /dev/null +++ b/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html @@ -0,0 +1,13 @@ +{% extends 'snippets/reading_modals/layout.html' %} +{% load i18n %} +{% load utilities %} + +{% block modal-title %} +{% blocktrans trimmed with book_title=book|book_title %} +Want to Read "{{ book_title }}" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} + +{% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html b/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html deleted file mode 100644 index 36addc7b..00000000 --- a/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html +++ /dev/null @@ -1,48 +0,0 @@ -{% extends 'components/modal.html' %} -{% load i18n %} - -{% block modal-title %} -{% blocktrans with book_title=book.title %}Finish "{{ book_title }}"{% endblocktrans %} -{% endblock %} - - -{% block modal-form-open %} - -{% endblock %} - -{% block modal-body %} - -{% endblock %} - -{% block modal-footer %} -
-
- - {% include 'snippets/privacy_select.html' %} -
-
- - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/close_button.html' with text=button_text controls_text="finish-reading" controls_uid=uuid %} -
-
-{% endblock %} -{% block modal-form-close %}
{% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index 40a9f6e7..18941812 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -19,13 +19,13 @@ {% endif %} -{% include 'snippets/shelve_button/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid %} +{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid %} -{% include 'snippets/shelve_button/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid %} +{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid %} -{% include 'snippets/shelve_button/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid readthrough=readthrough %} +{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid readthrough=readthrough %} -{% include 'snippets/shelve_button/progress_update_modal.html' with book=active_shelf_book.book controls_text="progress_update" controls_uid=uuid readthrough=readthrough %} +{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf_book.book controls_text="progress_update" controls_uid=uuid readthrough=readthrough %} {% endwith %} {% endif %} diff --git a/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html b/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html deleted file mode 100644 index 1858313b..00000000 --- a/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html +++ /dev/null @@ -1,42 +0,0 @@ -{% extends 'components/modal.html' %} -{% load i18n %} - -{% block modal-title %} -{% blocktrans trimmed with book_title=book.title %} -Start "{{ book_title }}" -{% endblocktrans %} -{% endblock %} - -{% block modal-form-open %} -
-{% endblock %} - -{% block modal-body %} - -{% endblock %} - -{% block modal-footer %} -
-
- - {% include 'snippets/privacy_select.html' %} -
-
- - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="start-reading" controls_uid=uuid %} -
-
-{% endblock %} -{% block modal-form-close %}
{% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/want_to_read_modal.html b/bookwyrm/templates/snippets/shelve_button/want_to_read_modal.html deleted file mode 100644 index 643e4a20..00000000 --- a/bookwyrm/templates/snippets/shelve_button/want_to_read_modal.html +++ /dev/null @@ -1,33 +0,0 @@ -{% extends 'components/modal.html' %} -{% load i18n %} - -{% block modal-title %} -{% blocktrans with book_title=book.title %}Want to Read "{{ book_title }}"{% endblocktrans %} -{% endblock %} - -{% block modal-form-open %} -
- {% csrf_token %} - - -{% endblock %} - -{% block modal-footer %} -
-
- - {% include 'snippets/privacy_select.html' %} -
-
- - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="want-to-read" controls_uid=uuid %} -
-
-{% endblock %} -{% block modal-form-close %}
{% endblock %} From e6b785d731a7eb72b72a36259c4b1dea2b5bb21e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 16 Aug 2021 12:28:04 -0700 Subject: [PATCH 04/30] No-update mode for "want to read" --- bookwyrm/static/js/bookwyrm.js | 17 +++++++++++++++++ .../snippets/reading_modals/layout.html | 8 +++++--- .../reading_modals/want_to_read_modal.html | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index a4002c2d..45044b03 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -177,6 +177,12 @@ let BookWyrm = new class { this.toggleCheckbox(checkbox, pressed); } + // Toggle form disabled, if appropriate + let disable = trigger.dataset.disables; + if (disable) { + this.toggleDisabled(disable, !pressed); + } + // Set focus, if appropriate. let focus = trigger.dataset.focusTarget; @@ -227,6 +233,17 @@ let BookWyrm = new class { document.getElementById(checkbox).checked = !!pressed; } + /** + * Enable or disable a form element or fieldset + * + * @param {string} form_element - id of the element + * @param {boolean} pressed - Is the trigger pressed? + * @return {undefined} + */ + toggleDisabled(form_element, pressed) { + document.getElementById(form_element).disabled = !!pressed; + } + /** * Give the focus to an element. * Only move the focus based on user interactions. diff --git a/bookwyrm/templates/snippets/reading_modals/layout.html b/bookwyrm/templates/snippets/reading_modals/layout.html index 877f14ef..5190ada4 100644 --- a/bookwyrm/templates/snippets/reading_modals/layout.html +++ b/bookwyrm/templates/snippets/reading_modals/layout.html @@ -8,8 +8,8 @@ {% with 0|uuid as local_uuid %}
-