mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
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:
@@ -4,7 +4,7 @@ from orderedset import OrderedSet
|
|||||||
|
|
||||||
from app import current_service
|
from app import current_service
|
||||||
from app.main import main
|
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
|
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(
|
return render_template(
|
||||||
'views/broadcast/areas.html',
|
'views/broadcast/areas.html',
|
||||||
form=form,
|
form=form,
|
||||||
|
search_form=SearchByNameForm(),
|
||||||
|
show_search_form=(len(form.areas.choices) > 7),
|
||||||
page_title=library.name,
|
page_title=library.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
{% from "components/page-footer.html" import sticky_page_footer %}
|
{% from "components/page-footer.html" import sticky_page_footer %}
|
||||||
{% from "components/checkbox.html" import checkboxes %}
|
{% from "components/checkbox.html" import checkboxes %}
|
||||||
{% from "components/form.html" import form_wrapper %}
|
{% from "components/form.html" import form_wrapper %}
|
||||||
|
{% from "components/live-search.html" import live_search %}
|
||||||
|
|
||||||
{% extends "withnav_template.html" %}
|
{% 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') }}
|
||||||
|
|
||||||
|
{{ live_search(target_selector='.multiple-choice', show=show_search_form, form=search_form, label='Search by name') }}
|
||||||
|
|
||||||
{% call form_wrapper() %}
|
{% call form_wrapper() %}
|
||||||
{{ checkboxes(form.areas, hide_legend=True) }}
|
{{ checkboxes(form.areas, hide_legend=True) }}
|
||||||
{{ sticky_page_footer('Add to broadcast') }}
|
{{ sticky_page_footer('Add to broadcast') }}
|
||||||
|
|||||||
Reference in New Issue
Block a user