diff --git a/bookwyrm/templates/shelf/create_shelf_form.html b/bookwyrm/templates/shelf/create_shelf_form.html index b7ea27de..e15e1cc1 100644 --- a/bookwyrm/templates/shelf/create_shelf_form.html +++ b/bookwyrm/templates/shelf/create_shelf_form.html @@ -7,21 +7,7 @@ {% block form %}
- {% csrf_token %} - -
- - -
- -
-
- {% include 'snippets/privacy_select.html' %} -
-
- -
-
+ {% include "shelf/form.html" with editable=shelf.editable form=create_form %}
{% endblock %} diff --git a/bookwyrm/templates/shelf/edit_shelf_form.html b/bookwyrm/templates/shelf/edit_shelf_form.html index 847d5e46..5951b6da 100644 --- a/bookwyrm/templates/shelf/edit_shelf_form.html +++ b/bookwyrm/templates/shelf/edit_shelf_form.html @@ -7,24 +7,7 @@ {% block form %}
- {% csrf_token %} - -
- {% if shelf.editable %} -
- - -
- {% else %} - - {% endif %} - -
- - {% include 'snippets/privacy_select.html' with current=shelf.privacy uuid=shelf.id no_label=True %} -
-
- + {% include "shelf/form.html" with editable=shelf.editable form=edit_form privacy=shelf.privacy %}
{% endblock %} diff --git a/bookwyrm/templates/shelf/form.html b/bookwyrm/templates/shelf/form.html new file mode 100644 index 00000000..9388a04e --- /dev/null +++ b/bookwyrm/templates/shelf/form.html @@ -0,0 +1,25 @@ +{% load i18n %} +{% csrf_token %} + + +{% if editable %} +
+ + {{ form.name }} +
+{% else %} + +{% endif %} + +
+ + {{ form.description }} +
+
+
+ {% include 'snippets/privacy_select.html' with current=privacy %} +
+
+ +
+
diff --git a/bookwyrm/views/shelf.py b/bookwyrm/views/shelf.py index 9642363e..cbec93d8 100644 --- a/bookwyrm/views/shelf.py +++ b/bookwyrm/views/shelf.py @@ -85,6 +85,8 @@ class Shelf(View): "shelves": shelves, "shelf": shelf, "books": page, + "edit_form": forms.ShelfForm(instance=shelf), + "create_form": forms.ShelfForm(), "page_range": paginated.get_elided_page_range( page.number, on_each_side=2, on_ends=1 ),