diff --git a/bookwyrm/templates/reading_progress/finish.html b/bookwyrm/templates/reading_progress/finish.html index a9f60f049..ca69128ec 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 9c4579471..e24a0e05b 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 e0353193a..6122ade3a 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 000000000..fdb5d7bb2 --- /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 "<em>{{ book_title }}</em>" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} +<form name="finish-reading" action="{% url 'reading-status' 'finish' book.id %}" method="post"> +{% endblock %} + +{% block reading-dates %} +<div class="columns"> + <div class="column is-half"> + <div class="field"> + <label class="label" for="finish_id_start_date_{{ uuid }}"> + {% trans "Started reading" %} + </label> + <input type="date" name="start_date" class="input" id="finish_id_start_date_{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}"> + </div> + </div> + <div class="column is-half"> + <div class="field"> + <label class="label" for="id_finish_date_{{ uuid }}"> + {% trans "Finished reading" %} + </label> + <input type="date" name="finish_date" class="input" id="id_finish_date_{{ uuid }}" value="{% now "Y-m-d" %}"> + </div> + </div> +</div> +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/form.html b/bookwyrm/templates/snippets/reading_modals/form.html new file mode 100644 index 000000000..da2aad93c --- /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 %} +<input type="hidden" name="user" value="{{ request.user.id }}"> +<input type="hidden" name="mention_books" value="{{ book.id }}"> +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/layout.html b/bookwyrm/templates/snippets/reading_modals/layout.html new file mode 100644 index 000000000..877f14ef9 --- /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 %} +<div class="is-flex is-justify-content-space-between"> + <label for="post_status_start_{{ uuid }}" data-controls="reading_content_{{ local_uuid }}_{{ uuid }}" data-controls-checkbox="post_status_start_{{ local_uuid }}_{{ uuid }}" aria-pressed="true"> + <input type="checkbox" name="post-status" class="checkbox" id="post_status_start_{{ local_uuid }}_{{ uuid }}" checked> + {% trans "Post to feed" %} + </label> + <div class="is-hidden" id="hide_reading_content_{{ local_uuid }}_{{ uuid }}"> + <button class="button is-link" type="submit">{% trans "Save" %}</button> + </div> +</div> + +<div id="reading_content_{{ local_uuid }}_{{ uuid }}"> + <hr aria-hidden="true"> + {% include "snippets/reading_modals/form.html" %} +</div> +{% 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 000000000..08191c798 --- /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 "<em>{{ book_title }}</em>" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} +<form name="start-reading" action="{% url 'reading-status' 'start' book.id %}" method="post"> +{% endblock %} + +{% block reading-dates %} +<div class="field"> + <label class="label" for="start_id_start_date_{{ uuid }}"> + {% trans "Started reading" %} + </label> + <input type="date" name="start_date" class="input" id="start_id_start_date_{{ uuid }}" value="{% now "Y-m-d" %}"> +</div> +{% 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 000000000..5669610cf --- /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 "<em>{{ book_title }}</em>" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} +<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post"> +{% 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 36addc7b8..000000000 --- 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 "<em>{{ book_title }}</em>"{% endblocktrans %} -{% endblock %} - - -{% block modal-form-open %} -<form name="finish-reading" action="{% url 'reading-status' 'finish' book.id %}" method="post"> -{% endblock %} - -{% block modal-body %} -<section class="modal-card-body"> - {% csrf_token %} - <input type="hidden" name="id" value="{{ readthrough.id }}"> - <div class="field"> - <label class="label" for="finish_id_start_date-{{ uuid }}"> - {% trans "Started reading" %} - </label> - <input type="date" name="start_date" class="input" id="finish_id_start_date-{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}"> - </div> - <div class="field"> - <label class="label" for="id_finish_date-{{ uuid }}"> - {% trans "Finished reading" %} - </label> - <input type="date" name="finish_date" class="input" id="id_finish_date-{{ uuid }}" value="{% now "Y-m-d" %}"> - </div> -</section> -{% endblock %} - -{% block modal-footer %} -<div class="columns"> - <div class="column field"> - <label for="post_status-{{ uuid }}"> - <input type="checkbox" name="post-status" class="checkbox" id="post_status-{{ uuid }}" checked> - {% trans "Post to feed" %} - </label> - {% include 'snippets/privacy_select.html' %} - </div> - <div class="column has-text-right"> - <button type="submit" class="button is-success">{% trans "Save" %}</button> - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/close_button.html' with text=button_text controls_text="finish-reading" controls_uid=uuid %} - </div> -</div> -{% endblock %} -{% block modal-form-close %}</form>{% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index 40a9f6e73..189418122 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -19,13 +19,13 @@ {% endif %} </div> -{% 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 1858313b3..000000000 --- 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 "<em>{{ book_title }}</em>" -{% endblocktrans %} -{% endblock %} - -{% block modal-form-open %} -<form name="start-reading" action="{% url 'reading-status' 'start' book.id %}" method="post"> -{% endblock %} - -{% block modal-body %} -<section class="modal-card-body"> - {% csrf_token %} - <div class="field"> - <label class="label" for="start_id_start_date-{{ uuid }}"> - {% trans "Started reading" %} - </label> - <input type="date" name="start_date" class="input" id="start_id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}"> - </div> -</section> -{% endblock %} - -{% block modal-footer %} -<div class="columns"> - <div class="column field"> - <label for="post_status_start-{{ uuid }}"> - <input type="checkbox" name="post-status" class="checkbox" id="post_status_start-{{ uuid }}" checked> - {% trans "Post to feed" %} - </label> - {% include 'snippets/privacy_select.html' %} - </div> - <div class="column has-text-right"> - <button class="button is-success" type="submit">{% trans "Save" %}</button> - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="start-reading" controls_uid=uuid %} - </div> -</div> -{% endblock %} -{% block modal-form-close %}</form>{% 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 643e4a202..000000000 --- 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 "<em>{{ book_title }}</em>"{% endblocktrans %} -{% endblock %} - -{% block modal-form-open %} -<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post"> - {% csrf_token %} - <input type="hidden" name="book" value="{{ active_shelf.book.id }}"> - <input type="hidden" name="shelf" value="to-read"> -{% endblock %} - -{% block modal-footer %} -<div class="columns"> - <div class="column field"> - <label for="post_status_want-{{ uuid }}"> - <input type="checkbox" name="post-status" class="checkbox" id="post_status_want-{{ uuid }}" checked> - {% trans "Post to feed" %} - </label> - {% include 'snippets/privacy_select.html' %} - </div> - <div class="column"> - <button class="button is-success" type="submit"> - <span>{% trans "Want to read" %}</span> - </button> - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="want-to-read" controls_uid=uuid %} - </div> -</div> -{% endblock %} -{% block modal-form-close %}</form>{% endblock %}