Simplify channel selection using radio buttons

This takes a similar approach as in the previous commit. Since the
"training channel" doesn't really exist, we need some extra code
to pre-select it if a service is already in training mode. As in
the previous commit, I've removed a few non-critical test cases
where we really don't need to test exhaustively.

Note that we also need some specific code to avoid pre-selecting an
option for non-broadcast services, which only used to work by fluke:
we would try to populate the field with (False, None, 'all'), which
isn't a valid combination, so nothing was selected.
This commit is contained in:
Ben Thorner
2021-06-07 17:23:48 +01:00
parent b38cdcad63
commit 5bfe5f86de
3 changed files with 26 additions and 38 deletions

View File

@@ -2392,14 +2392,14 @@ class ServiceBroadcastAccountTypeField(GovukRadiosField):
class ServiceBroadcastChannelForm(StripWhitespaceForm):
channel = ServiceBroadcastAccountTypeField(
channel = GovukRadiosField(
'Emergency alerts settings',
thing='mode or channel',
choices=[
("training-test-all", "Training mode"),
("live-test-all", "Test channel"),
("live-severe-all", "Live channel"),
("live-government-all", "Government channel"),
("training", "Training mode"),
("test", "Test channel"),
("severe", "Live channel"),
("government", "Government channel"),
],
)