From 6ce4be74067f1d842d0588a19e561ad47884a282 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 3 Feb 2021 12:25:33 -0800 Subject: [PATCH 1/4] Adds inline form component --- .../templates/components/inline_form.html | 13 ++++++++ bookwyrm/templates/lists/create_form.html | 11 +++++++ bookwyrm/templates/lists/edit_form.html | 11 +++++++ bookwyrm/templates/lists/list_layout.html | 12 ++------ bookwyrm/templates/lists/lists.html | 30 ++++++++----------- 5 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 bookwyrm/templates/components/inline_form.html create mode 100644 bookwyrm/templates/lists/create_form.html create mode 100644 bookwyrm/templates/lists/edit_form.html diff --git a/bookwyrm/templates/components/inline_form.html b/bookwyrm/templates/components/inline_form.html new file mode 100644 index 00000000..6a244ffd --- /dev/null +++ b/bookwyrm/templates/components/inline_form.html @@ -0,0 +1,13 @@ + diff --git a/bookwyrm/templates/lists/create_form.html b/bookwyrm/templates/lists/create_form.html new file mode 100644 index 00000000..706dff08 --- /dev/null +++ b/bookwyrm/templates/lists/create_form.html @@ -0,0 +1,11 @@ +{% extends 'components/inline_form.html' %} + +{% block header %} +Create List +{% endblock %} + +{% block form %} +
+ {% include 'lists/form.html' %} +
+{% endblock %} diff --git a/bookwyrm/templates/lists/edit_form.html b/bookwyrm/templates/lists/edit_form.html new file mode 100644 index 00000000..55723b72 --- /dev/null +++ b/bookwyrm/templates/lists/edit_form.html @@ -0,0 +1,11 @@ +{% extends 'components/inline_form.html' %} + +{% block header %} +Edit List +{% endblock %} + +{% block form %} +
+ {% include 'lists/form.html' %} +
+{% endblock %} diff --git a/bookwyrm/templates/lists/list_layout.html b/bookwyrm/templates/lists/list_layout.html index 1887cd82..d3ff2c48 100644 --- a/bookwyrm/templates/lists/list_layout.html +++ b/bookwyrm/templates/lists/list_layout.html @@ -15,15 +15,9 @@ {% endif %} - +
+ {% include 'lists/edit_form.html' with controls_text="edit-list" %} +
{% block panel %}{% endblock %} diff --git a/bookwyrm/templates/lists/lists.html b/bookwyrm/templates/lists/lists.html index a0e18933..ad2dfbaf 100644 --- a/bookwyrm/templates/lists/lists.html +++ b/bookwyrm/templates/lists/lists.html @@ -5,26 +5,20 @@

Lists

{% if request.user.is_authenticated and not lists.has_previous %} -
-
-
-

Your lists

-
-
- {% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text="Create new list" focus="create-list-header" %} -
-
+
+
+

Your lists

+
+
+ {% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text="Create new list" focus="create-list-header" %} +
+
- +
+ {% include 'lists/create_form.html' with controls_text="create-list" %} +
+
{% if request.user.list_set.exists %} {% include 'lists/list_items.html' with lists=request.user.list_set.all|slice:4 %} {% endif %} From bcbcdd5b3b070c35537b7aa4089c79cc724a8956 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 3 Feb 2021 12:36:20 -0800 Subject: [PATCH 2/4] Uses component for create shelf form --- .../templates/user/create_shelf_form.html | 26 +++++++++++++++++++ bookwyrm/templates/user/shelf.html | 23 +++------------- bookwyrm/urls.py | 2 +- 3 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 bookwyrm/templates/user/create_shelf_form.html diff --git a/bookwyrm/templates/user/create_shelf_form.html b/bookwyrm/templates/user/create_shelf_form.html new file mode 100644 index 00000000..89f41fd8 --- /dev/null +++ b/bookwyrm/templates/user/create_shelf_form.html @@ -0,0 +1,26 @@ +{% extends 'components/inline_form.html' %} + +{% block header %} +Create New Shelf +{% endblock %} + +{% block form %} +
+ {% csrf_token %} + +
+ + +
+ +
+
+ {% include 'snippets/privacy_select.html' %} +
+
+ +
+
+
+{% endblock %} + diff --git a/bookwyrm/templates/user/shelf.html b/bookwyrm/templates/user/shelf.html index add5e5db..07b4f30b 100644 --- a/bookwyrm/templates/user/shelf.html +++ b/bookwyrm/templates/user/shelf.html @@ -29,30 +29,13 @@ {% if is_self %}
- {% include 'snippets/toggle/open_button.html' with text="Create shelf" icon="plus" class="is-clickable" controls_text="create-shelf-form" %} + {% include 'snippets/toggle/open_button.html' with text="Create shelf" icon="plus" controls_text="create-shelf-form" focus="create-shelf-form-header" %}
{% endif %}
- -