From 306b4c8e5edb03e0292b6ca6dc26d480cc5eb429 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Sun, 8 Feb 2026 21:43:58 -0500 Subject: [PATCH] new template _partials for apps.dashboard, incl. _form.html & _scripts.html; respective form, table & content code offloaded from base.html, home.html & list.html; functional_tests.test_my_list TODO resumed (only FT not currently passing, but this is as expected) --- src/functional_tests/test_my_lists.py | 2 - .../apps/dashboard/_partials/_form.html | 17 +++++++++ .../apps/dashboard/_partials/_scripts.html | 6 +++ src/templates/apps/dashboard/home.html | 9 ++++- src/templates/apps/dashboard/list.html | 27 ++++++++++---- src/templates/core/base.html | 37 +++---------------- 6 files changed, 56 insertions(+), 42 deletions(-) create mode 100644 src/templates/apps/dashboard/_partials/_form.html create mode 100644 src/templates/apps/dashboard/_partials/_scripts.html diff --git a/src/functional_tests/test_my_lists.py b/src/functional_tests/test_my_lists.py index a122a34..554e0e0 100644 --- a/src/functional_tests/test_my_lists.py +++ b/src/functional_tests/test_my_lists.py @@ -39,8 +39,6 @@ class MyListsTest(FunctionalTest): ) ) - return # TODO: resume here after templates refactor - self.wait_for( lambda: self.browser.find_element(By.LINK_TEXT, "Reticulate splines") ) diff --git a/src/templates/apps/dashboard/_partials/_form.html b/src/templates/apps/dashboard/_partials/_form.html new file mode 100644 index 0000000..6de5867 --- /dev/null +++ b/src/templates/apps/dashboard/_partials/_form.html @@ -0,0 +1,17 @@ +
+ {% csrf_token %} + + {% if form.errors %} +
+ {{ form.errors.text.0 }} +
+ {% endif %} +
\ No newline at end of file diff --git a/src/templates/apps/dashboard/_partials/_scripts.html b/src/templates/apps/dashboard/_partials/_scripts.html new file mode 100644 index 0000000..76ac717 --- /dev/null +++ b/src/templates/apps/dashboard/_partials/_scripts.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/src/templates/apps/dashboard/home.html b/src/templates/apps/dashboard/home.html index 67e9937..d9ea19f 100644 --- a/src/templates/apps/dashboard/home.html +++ b/src/templates/apps/dashboard/home.html @@ -3,4 +3,11 @@ {% block title_text %}Start a new to-do list{% endblock title_text %} {% block header_text %}Start a new to-do list{% endblock header_text %} -{% block form_action %}{% url "new_list" %}{% endblock form_action %} +{% block extra_header %} + {% url "new_list" as form_action %} + {% include "apps/dashboard/_partials/_form.html" with form=form form_action=form_action %} +{% endblock extra_header %} + +{% block scripts %} + {% include "apps/dashboard/_partials/_scripts.html" %} +{% endblock scripts %} diff --git a/src/templates/apps/dashboard/list.html b/src/templates/apps/dashboard/list.html index ec9340b..e583f5b 100644 --- a/src/templates/apps/dashboard/list.html +++ b/src/templates/apps/dashboard/list.html @@ -3,13 +3,24 @@ {% block title_text %}Your to-do list{% endblock title_text %} {% block header_text %}Your to-do list{% endblock header_text %} -{% block form_action %}{% url "view_list" list.id %}{% endblock form_action %} -{% block table %} - - {% for item in list.item_set.all %} - - {% endfor %} -
{{ forloop.counter }}. {{ item.text }}
-{% endblock table %} +{% block extra_header %} + {% url "view_list" list.id as form_action %} + {% include "apps/dashboard/_partials/_form.html" with form=form form_action=form_action %} +{% endblock extra_header %} +{% block content %} +
+
+ + {% for item in list.item_set.all %} + + {% endfor %} +
{{ forloop.counter }}. {{ item.text }}
+
+
+{% endblock content %} + +{% block scripts %} + {% include "apps/dashboard/_partials/_scripts.html" %} +{% endblock scripts %} diff --git a/src/templates/core/base.html b/src/templates/core/base.html index d7128cd..9aaf0b3 100644 --- a/src/templates/core/base.html +++ b/src/templates/core/base.html @@ -62,33 +62,13 @@

{% block header_text %}{% endblock header_text %}

- -
- {% csrf_token %} - - {% if form.errors %} -
- {{ form.errors.text.0 }} -
- {% endif %} -
+ {% block extra_header %} + {% endblock extra_header %}
-
-
- {% block table %} - {% endblock table %} -
-
+ {% block content %} + {% endblock content %} @@ -96,12 +76,7 @@ - - - + {% block scripts %} + {% endblock scripts %} \ No newline at end of file