mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Update all single field checkboxes
Includes adding some code to govukCheckboxesField to add a single boolean-like option by default, if there are no choices added.
This commit is contained in:
@@ -1323,7 +1323,7 @@ class ServiceContactDetailsForm(StripWhitespaceForm):
|
||||
|
||||
class ServiceReplyToEmailForm(StripWhitespaceForm):
|
||||
email_address = email_address(label='Reply-to email address', gov_user=False)
|
||||
is_default = BooleanField("Make this email address the default")
|
||||
is_default = govukCheckboxField("Make this email address the default")
|
||||
|
||||
|
||||
class ServiceSmsSenderForm(StripWhitespaceForm):
|
||||
@@ -1337,11 +1337,11 @@ class ServiceSmsSenderForm(StripWhitespaceForm):
|
||||
DoesNotStartWithDoubleZero(),
|
||||
]
|
||||
)
|
||||
is_default = BooleanField("Make this text message sender the default")
|
||||
is_default = govukCheckboxField("Make this text message sender the default")
|
||||
|
||||
|
||||
class ServiceEditInboundNumberForm(StripWhitespaceForm):
|
||||
is_default = BooleanField("Make this text message sender the default")
|
||||
is_default = govukCheckboxField("Make this text message sender the default")
|
||||
|
||||
|
||||
class ServiceLetterContactBlockForm(StripWhitespaceForm):
|
||||
@@ -1351,7 +1351,7 @@ class ServiceLetterContactBlockForm(StripWhitespaceForm):
|
||||
NoCommasInPlaceHolders()
|
||||
]
|
||||
)
|
||||
is_default = BooleanField("Set as your default address")
|
||||
is_default = govukCheckboxField("Set as your default address")
|
||||
|
||||
def validate_letter_contact_block(self, field):
|
||||
line_count = field.data.strip().count('\n')
|
||||
@@ -1517,7 +1517,7 @@ class Whitelist(StripWhitespaceForm):
|
||||
class DateFilterForm(StripWhitespaceForm):
|
||||
start_date = DateField("Start Date", [validators.optional()])
|
||||
end_date = DateField("End Date", [validators.optional()])
|
||||
include_from_test_key = BooleanField("Include test keys", default="checked", false_values={"N"})
|
||||
include_from_test_key = govukCheckboxField("Include test keys")
|
||||
|
||||
|
||||
class RequiredDateFilterForm(StripWhitespaceForm):
|
||||
|
||||
@@ -168,9 +168,11 @@ def platform_admin_services():
|
||||
# Default to True if the user hasn’t done any filtering,
|
||||
# otherwise respect their choice
|
||||
form.include_from_test_key.data = True
|
||||
|
||||
include_from_test_key = form.include_from_test_key.data
|
||||
api_args = {'detailed': True,
|
||||
'only_active': False, # specifically DO get inactive services
|
||||
'include_from_test_key': form.include_from_test_key.data,
|
||||
'include_from_test_key': include_from_test_key,
|
||||
}
|
||||
|
||||
if form.start_date.data:
|
||||
@@ -184,7 +186,7 @@ def platform_admin_services():
|
||||
|
||||
return render_template(
|
||||
'views/platform-admin/services.html',
|
||||
include_from_test_key=form.include_from_test_key.data,
|
||||
include_from_test_key=include_from_test_key,
|
||||
form=form,
|
||||
services=list(format_stats_by_service(services)),
|
||||
page_title='{} services'.format(
|
||||
|
||||
Reference in New Issue
Block a user