Add search form

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.
This commit is contained in:
Chris Hill-Scott
2020-07-06 10:53:16 +01:00
parent 29ad5cf510
commit 773f0b9ce7
2 changed files with 6 additions and 1 deletions

View File

@@ -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,
)

View File

@@ -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') }}