From 88e1d419da6306753fc3a2698695b2a110e25a88 Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Thu, 10 Aug 2023 16:27:00 -0400 Subject: [PATCH 1/3] Fix bug by checking to see if first item in the result set for a change_list_results table row is a form before performing the checkbox slice/markup switch --- .../templates/admin/change_list_results.html | 114 +++++++++++------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/src/registrar/templates/admin/change_list_results.html b/src/registrar/templates/admin/change_list_results.html index a9c5e5b4d..34f733ad4 100644 --- a/src/registrar/templates/admin/change_list_results.html +++ b/src/registrar/templates/admin/change_list_results.html @@ -13,57 +13,49 @@ Load our custom filters to extract info from the django generated markup. {% endif %} {% if results %}
- +
-{# .gov - hardcode the select all checkbox #} - -{# .gov - don't let django generate the select all checkbox #} -{% for header in result_headers|slice:"1:" %} +{% if results.0.form %} + {# .gov - hardcode the select all checkbox #} + + {# .gov - don't let django generate the select all checkbox #} + {% for header in result_headers|slice:"1:" %} + {% endfor %} -{% endfor %} + + + - - - + {% comment %} + .gov - hardcode the row checkboxes using the custom filters to extract + the value attribute's value, and a label based on the anchor elements's + text. Then edit the for loop to keep django from generating the row select + checkboxes. + {% endcomment %} -{% comment %} -{% for result in results %} -{% if result.form.non_field_errors %} - -{% endif %} -{% for item in result %}{{ item }}{% endfor %} -{% endfor %} -{% endcomment %} - -{% comment %} -.gov - hardcode the row checkboxes using the custom filters to extract -the value attribute's value, and a label based on the anchor elements's -text. Then edit the for loop to keep django from generating the row select -checkboxes. -{% endcomment %} -{% for result in results %} + {% for result in results %} {% if result.form.non_field_errors %} {% endif %} @@ -82,7 +74,37 @@ checkboxes. {{ item }} {% endfor %} -{% endfor %} + {% endfor %} + +{% else %} + + {% for header in result_headers %} + {% endfor %} + + + + + + {% for result in results %} + {% if result.form.non_field_errors %} + + {% endif %} + {% for item in result %}{{ item }}{% endfor %} + {% endfor %} + +{% endif %}
-
- - - - -
-
-
+
+ + + + +
+
+
+ {% if header.sortable %} + {% if header.sort_priority > 0 %} +
+ + {% if num_sorted_fields > 1 %}{{ header.sort_priority }}{% endif %} + +
+ {% endif %} + {% endif %} +
{% if header.sortable %}{{ header.text|capfirst }}{% else %}{{ header.text|capfirst }}{% endif %}
+
+
- {% if header.sortable %} - {% if header.sort_priority > 0 %} -
- - {% if num_sorted_fields > 1 %}{{ header.sort_priority }}{% endif %} - -
- {% endif %} - {% endif %} -
{% if header.sortable %}{{ header.text|capfirst }}{% else %}{{ header.text|capfirst }}{% endif %}
-
-
{{ result.form.non_field_errors }}
{{ result.form.non_field_errors }}
+ {% if header.sortable %} + {% if header.sort_priority > 0 %} +
+ + {% if num_sorted_fields > 1 %}{{ header.sort_priority }}{% endif %} + +
+ {% endif %} + {% endif %} +
{% if header.sortable %}{{ header.text|capfirst }}{% else %}{{ header.text|capfirst }}{% endif %}
+
+
{{ result.form.non_field_errors }}
From a2f0fd9522d3f039e73f0dd0317ef8b7be41ecb1 Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Fri, 11 Aug 2023 12:18:24 -0400 Subject: [PATCH 2/3] revert USDWDS table markup which was removed by mistake --- src/registrar/templates/admin/change_list_results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/admin/change_list_results.html b/src/registrar/templates/admin/change_list_results.html index 34f733ad4..fb77bd785 100644 --- a/src/registrar/templates/admin/change_list_results.html +++ b/src/registrar/templates/admin/change_list_results.html @@ -13,7 +13,7 @@ Load our custom filters to extract info from the django generated markup. {% endif %} {% if results %}
- +
From 02556418f882b4a45b18547d0354e580b18e4a62 Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Fri, 11 Aug 2023 12:24:06 -0400 Subject: [PATCH 3/3] explain the 'results doesn't have a form as its first element', which is far away from its if --- src/registrar/templates/admin/change_list_results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/admin/change_list_results.html b/src/registrar/templates/admin/change_list_results.html index fb77bd785..9ee3f9f59 100644 --- a/src/registrar/templates/admin/change_list_results.html +++ b/src/registrar/templates/admin/change_list_results.html @@ -76,7 +76,7 @@ Load our custom filters to extract info from the django generated markup. {% endfor %} -{% else %} +{% else %} {# results doesn't have a form as its first element #} {% for header in result_headers %}