From 773f0b9ce78a78d0f9a620cb6cd792bd2ce67ac8 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 6 Jul 2020 10:53:16 +0100 Subject: [PATCH] Add search form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There can be lots of areas in a library, for example local councils. So when there is, let’s allow people to do the find-as-you-type thing we support in lots of other places. --- app/main/views/broadcast.py | 4 +++- app/templates/views/broadcast/areas.html | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/main/views/broadcast.py b/app/main/views/broadcast.py index 927a1907c..c2401e49e 100644 --- a/app/main/views/broadcast.py +++ b/app/main/views/broadcast.py @@ -4,7 +4,7 @@ from orderedset import OrderedSet from app import current_service from app.main import main -from app.main.forms import BroadcastAreaForm +from app.main.forms import BroadcastAreaForm, SearchByNameForm from app.utils import service_has_permission, user_has_permissions @@ -69,6 +69,8 @@ def choose_broadcast_area(service_id, library_slug): return render_template( 'views/broadcast/areas.html', form=form, + search_form=SearchByNameForm(), + show_search_form=(len(form.areas.choices) > 7), page_title=library.name, ) diff --git a/app/templates/views/broadcast/areas.html b/app/templates/views/broadcast/areas.html index c8fbdd7eb..b3d979dbc 100644 --- a/app/templates/views/broadcast/areas.html +++ b/app/templates/views/broadcast/areas.html @@ -2,6 +2,7 @@ {% from "components/page-footer.html" import sticky_page_footer %} {% from "components/checkbox.html" import checkboxes %} {% from "components/form.html" import form_wrapper %} +{% from "components/live-search.html" import live_search %} {% extends "withnav_template.html" %} @@ -18,6 +19,8 @@ {{ live_search(target_selector='.multiple-choice', show=show_search_form, form=search_form, label='Search by name') }} + {{ live_search(target_selector='.multiple-choice', show=show_search_form, form=search_form, label='Search by name') }} + {% call form_wrapper() %} {{ checkboxes(form.areas, hide_legend=True) }} {{ sticky_page_footer('Add to broadcast') }}