diff --git a/bookwyrm/models/readthrough.py b/bookwyrm/models/readthrough.py index 3445573c4..b76b90221 100644 --- a/bookwyrm/models/readthrough.py +++ b/bookwyrm/models/readthrough.py @@ -7,6 +7,7 @@ from .base_model import BookWyrmModel class ProgressMode(models.TextChoices): + """ types of prgress available """ PAGE = "PG", "page" PERCENT = "PCT", "percent" @@ -32,10 +33,12 @@ class ReadThrough(BookWyrmModel): super().save(*args, **kwargs) def create_update(self): + """ add update to the readthrough """ if self.progress: return self.progressupdate_set.create( user=self.user, progress=self.progress, mode=self.progress_mode ) + return None class ProgressUpdate(BookWyrmModel): diff --git a/bookwyrm/static/css/format.css b/bookwyrm/static/css/format.css index 435d8eb9e..05451e160 100644 --- a/bookwyrm/static/css/format.css +++ b/bookwyrm/static/css/format.css @@ -14,9 +14,6 @@ html { .card { overflow: visible; } -.card-header-title { - overflow: hidden; -} /* --- SHELVING --- */ .shelf-option:disabled > *::after { diff --git a/bookwyrm/templates/feed/feed_layout.html b/bookwyrm/templates/feed/feed_layout.html index 24294e5d0..6ed696a12 100644 --- a/bookwyrm/templates/feed/feed_layout.html +++ b/bookwyrm/templates/feed/feed_layout.html @@ -47,20 +47,18 @@ {% for book in shelf.books %}
-

- {% include 'snippets/book_titleby.html' with book=book %} -

+
+
+

{% include 'snippets/book_titleby.html' with book=book %}

+ {% include 'snippets/shelve_button/shelve_button.html' with book=book %} +
+
{% trans "Close" as button_text %} {% include 'snippets/toggle/toggle_button.html' with label=button_text controls_text="book" controls_uid=book.id class="delete" nonbutton=True pressed=True %}
- {% include 'snippets/shelve_button/shelve_button.html' with book=book %} - {% active_shelf book as active_shelf %} - {% if active_shelf.shelf.identifier == 'reading' and book.latest_readthrough %} - {% include 'snippets/progress_update.html' with readthrough=book.latest_readthrough %} - {% endif %} {% include 'snippets/create_status.html' with book=book %}
diff --git a/bookwyrm/templates/snippets/create_status_form.html b/bookwyrm/templates/snippets/create_status_form.html index 187eae605..d0b763bfd 100644 --- a/bookwyrm/templates/snippets/create_status_form.html +++ b/bookwyrm/templates/snippets/create_status_form.html @@ -13,7 +13,15 @@ {% endif %}
{% if type != 'reply' and type != 'direct' %} - + {% endif %} {% if type == 'review' %} @@ -45,6 +53,35 @@ {% include 'snippets/content_warning_field.html' with parent_status=status %}
+ {% elif type == 'comment' %} +
+ {% active_shelf book as active_shelf %} + {% if active_shelf.shelf.identifier == 'reading' and book.latest_readthrough %} + + {% with readthrough=book.latest_readthrough %} +
+ +
+
+ +
+
+ +
+
+ {% if readthrough.progress_mode == 'PG' and book.pages %} +

{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}

+ {% endif %} +
+ {% endwith %} + {% endif %} +
{% endif %} {# bottom bar #} diff --git a/bookwyrm/templates/snippets/progress_update.html b/bookwyrm/templates/snippets/progress_update.html deleted file mode 100644 index cb7096258..000000000 --- a/bookwyrm/templates/snippets/progress_update.html +++ /dev/null @@ -1,28 +0,0 @@ -{% load i18n %} -
- {% csrf_token %} - -
- -
-
- -
-
- -
-
- -
-
- {% if readthrough.progress_mode == 'PG' and book.pages %} -

{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}

- {% endif %} -
-
diff --git a/bookwyrm/templates/snippets/shelve_button/progress_update_modal.html b/bookwyrm/templates/snippets/shelve_button/progress_update_modal.html new file mode 100644 index 000000000..5879264b5 --- /dev/null +++ b/bookwyrm/templates/snippets/shelve_button/progress_update_modal.html @@ -0,0 +1,42 @@ +{% extends 'components/modal.html' %} +{% load i18n %} + +{% block modal-title %} +{% trans "Update progress" %} +{% endblock %} + +{% block modal-form-open %} +
+{% endblock %} + +{% block modal-body %} +{% csrf_token %} + +
+ +
+
+ +
+
+ +
+
+ {% if readthrough.progress_mode == 'PG' and book.pages %} +

{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}

+ {% endif %} +
+{% endblock %} + +{% block modal-footer %} + +{% trans "Cancel" as button_text %} +{% include 'snippets/toggle/toggle_button.html' with text=button_text %} +{% 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 5f6ed8d20..586d7d9d1 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -3,7 +3,7 @@ {% with book.id|uuid as uuid %} {% active_shelf book as active_shelf %} -
+
{% if switch_mode and active_shelf.book != book %}
{% include 'snippets/switch_edition_button.html' with edition=book size='is-small' %} @@ -23,5 +23,7 @@ {% latest_read_through book request.user as readthrough %} {% include 'snippets/shelve_button/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=shelf_book.book controls_text="progress-update" controls_uid=uuid readthrough=readthrough %} + {% endwith %} {% endif %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html index d6fdb13bc..56783b2cc 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html @@ -27,3 +27,11 @@
{% if dropdown %}{% endif %} {% endfor %} +{% if dropdown %} +
  • + +
  • +{% endif %} diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 44492668b..c24b83f70 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -183,7 +183,7 @@ urlpatterns = [ re_path(r"^shelve/?$", views.shelve), re_path(r"^unshelve/?$", views.unshelve), # reading progress - re_path(r"^edit-readthrough/?$", views.edit_readthrough), + re_path(r"^edit-readthrough/?$", views.edit_readthrough, name="edit-readthrough"), re_path(r"^delete-readthrough/?$", views.delete_readthrough), re_path(r"^create-readthrough/?$", views.create_readthrough), re_path(r"^delete-progressupdate/?$", views.delete_progressupdate),