diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 7ba7bd97..37cb2e87 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -478,3 +478,8 @@ class SortListForm(forms.Form): ("descending", _("Descending")), ), ) + +class ReadThroughForm(CustomForm): + class Meta: + model = models.ReadThrough + fields = ["user", "book", "start_date", "finish_date"] diff --git a/bookwyrm/templates/book/add_readthrough_modal.html b/bookwyrm/templates/book/add_readthrough_modal.html new file mode 100644 index 00000000..45cbb2aa --- /dev/null +++ b/bookwyrm/templates/book/add_readthrough_modal.html @@ -0,0 +1,28 @@ +{% extends "components/modal.html" %} +{% load i18n %} +{% load utilities %} + +{% block modal-title %} +{% blocktrans trimmed with title=book|book_title %} +Add read dates for "{{ title }}" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} +
+{% endblock %} + +{% block modal-body %} +{% include 'snippets/readthrough_form.html' with readthrough=None %} +{% endblock %} + +{% block modal-footer %} + +{% if not static %} + +{% endif %} +{% endblock %} + +{% block modal-form-close %} +
+{% endblock %} diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index 19dbccbd..38dffd20 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -237,24 +237,16 @@

{% trans "Your reading activity" %}

- {% 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 "book/add_readthrough_modal.html" with id="add-readthrough" %} + {% if not readthroughs.exists %}

{% trans "You don't have any reading activity for this book." %}

{% endif %} diff --git a/bookwyrm/templates/snippets/readthrough_form.html b/bookwyrm/templates/snippets/readthrough_form.html index 295ad7c6..1558dada 100644 --- a/bookwyrm/templates/snippets/readthrough_form.html +++ b/bookwyrm/templates/snippets/readthrough_form.html @@ -4,6 +4,7 @@ {% csrf_token %} +