diff --git a/bookwyrm/forms/books.py b/bookwyrm/forms/books.py index 72df1371..20f307fa 100644 --- a/bookwyrm/forms/books.py +++ b/bookwyrm/forms/books.py @@ -85,3 +85,27 @@ class EditionForm(CustomForm): ), "ASIN": forms.TextInput(attrs={"aria-describedby": "desc_ASIN"}), } + + +class EditionFromWorkForm(CustomForm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # make all fields hidden + for visible in self.visible_fields(): + visible.field.widget = forms.HiddenInput() + + class Meta: + model = models.Work + fields = [ + "title", + "subtitle", + "authors", + "description", + "languages", + "series", + "series_number", + "subjects", + "subject_places", + "cover", + "first_published_date", + ] diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index fa098281..453480f9 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -208,9 +208,17 @@ {% endif %} - {% if book.parent_work.editions.count > 1 %} -

{% blocktrans with path=book.parent_work.local_path count=book.parent_work.editions.count %}{{ count }} editions{% endblocktrans %}

- {% endif %} + {% with work=book.parent_work %} +

+ + {% blocktrans trimmed count counter=work.editions.count with count=work.editions.count|intcomma %} + {{ count }} edition + {% plural %} + {{ count }} editions + {% endblocktrans %} + +

+ {% endwith %} {# user's relationship to the book #} diff --git a/bookwyrm/templates/book/edit/edit_book.html b/bookwyrm/templates/book/edit/edit_book.html index 3d41058e..b088c1e8 100644 --- a/bookwyrm/templates/book/edit/edit_book.html +++ b/bookwyrm/templates/book/edit/edit_book.html @@ -3,18 +3,24 @@ {% load humanize %} {% load utilities %} -{% block title %}{% if book %}{% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %}{% else %}{% trans "Add Book" %}{% endif %}{% endblock %} +{% block title %} + {% if book.title %} + {% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %} + {% else %} + {% trans "Add Book" %} + {% endif %} +{% endblock %} {% block content %}

- {% if book %} + {% if book.title %} {% blocktrans with book_title=book.title %}Edit "{{ book_title }}"{% endblocktrans %} {% else %} {% trans "Add Book" %} {% endif %}

- {% if book %} + {% if book.created_date %}
{% trans "Added:" %}
{{ book.created_date | naturaltime }}
@@ -33,7 +39,7 @@
{{ match.parent_work.title }} {% endfor %} -