From 797e4ad6419c02f8fd5316496bfcc3d1503827d9 Mon Sep 17 00:00:00 2001
From: Mitch Dawson <86007219+mitchdawson1982@users.noreply.github.com>
Date: Tue, 9 Jul 2024 09:26:26 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Live=20filtering=20(#520)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* initial commit
* remove apply filter button
* refactored to remove addition script function
* update from oninput to onchange
* remove apply filters methods
---
home/forms/search.py | 13 +++++++++++--
templates/partial/filter.html | 4 ----
tests/selenium/conftest.py | 5 -----
tests/selenium/test_search_controls.py | 9 ---------
4 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/home/forms/search.py b/home/forms/search.py
index 23b653ff..70449642 100644
--- a/home/forms/search.py
+++ b/home/forms/search.py
@@ -93,6 +93,7 @@ class SearchForm(forms.Form):
"form": "searchform",
"class": "govuk-select",
"aria-label": "Domain",
+ "onchange": "document.getElementById('searchform').submit();",
}
),
)
@@ -107,14 +108,22 @@ class SearchForm(forms.Form):
choices=get_where_to_access_choices,
required=False,
widget=forms.CheckboxSelectMultiple(
- attrs={"class": "govuk-checkboxes__input", "form": "searchform"}
+ attrs={
+ "class": "govuk-checkboxes__input",
+ "form": "searchform",
+ "onchange": "document.getElementById('searchform').submit();",
+ }
),
)
entity_types = forms.MultipleChoiceField(
choices=get_entity_types,
required=False,
widget=forms.CheckboxSelectMultiple(
- attrs={"class": "govuk-checkboxes__input", "form": "searchform"}
+ attrs={
+ "class": "govuk-checkboxes__input",
+ "form": "searchform",
+ "onchange": "document.getElementById('searchform').submit();",
+ }
),
)
sort = forms.ChoiceField(
diff --git a/templates/partial/filter.html b/templates/partial/filter.html
index 352d5e92..b2740217 100644
--- a/templates/partial/filter.html
+++ b/templates/partial/filter.html
@@ -14,10 +14,6 @@
Filter
{% include "partial/selected_filters.html" %}
{% endif %}
-
-