mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-24 17:31:19 -04:00
Convert checkboxes for broadcast areas
Includes removal of MultiCheckboxField due to it no longer being used elsewhere in this file.
This commit is contained in:
@@ -38,7 +38,6 @@ from wtforms import (
|
||||
)
|
||||
from wtforms.fields.html5 import EmailField, SearchField, TelField
|
||||
from wtforms.validators import URL, DataRequired, Length, Optional, Regexp
|
||||
from wtforms.widgets import CheckboxInput, ListWidget
|
||||
|
||||
from app import format_thousands
|
||||
from app.main.validators import (
|
||||
@@ -118,11 +117,6 @@ def get_next_days_until(until):
|
||||
]
|
||||
|
||||
|
||||
class MultiCheckboxField(SelectMultipleField):
|
||||
widget = ListWidget(prefix_label=False)
|
||||
option_widget = CheckboxInput()
|
||||
|
||||
|
||||
class RadioField(WTFormsRadioField):
|
||||
|
||||
def __init__(
|
||||
@@ -2135,11 +2129,13 @@ class AcceptAgreementForm(StripWhitespaceForm):
|
||||
|
||||
class BroadcastAreaForm(StripWhitespaceForm):
|
||||
|
||||
areas = MultiCheckboxField('Choose areas to broadcast to')
|
||||
areas = govukCheckboxesField('Choose areas to broadcast to')
|
||||
|
||||
def __init__(self, choices, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.areas.choices = choices
|
||||
self.areas.render_as_list = True
|
||||
self.areas.param_extensions = {'fieldset': {'legend': {'classes': 'govuk-visually-hidden'}}}
|
||||
|
||||
@classmethod
|
||||
def from_library(cls, library):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% 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 %}
|
||||
|
||||
@@ -17,10 +16,10 @@
|
||||
back_link=url_for('.choose_broadcast_library', service_id=current_service.id, broadcast_message_id=broadcast_message.id),
|
||||
)}}
|
||||
|
||||
{{ live_search(target_selector='.multiple-choice', show=show_search_form, form=search_form, label='Search by name') }}
|
||||
{{ live_search(target_selector='.govuk-checkboxes__item', show=show_search_form, form=search_form, label='Search by name') }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{ checkboxes(form.areas, hide_legend=True) }}
|
||||
{{ form.areas }}
|
||||
{{ sticky_page_footer('Add to broadcast') }}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user