Add flow for composing an alert without a template

We think that in some cases alerts will be composed in the moment, and
therefore making people first create a template is:
- not a good use of their time
- adding some conceptual complexity which they don’t need

This commit makes it possible to type some words and have them go
straight into the `content` field in the database.

In the future we might want to progressively enhance the radio buttons
so they show on the same page (like we do with the grey buttons on the
templates page).
This commit is contained in:
Chris Hill-Scott
2020-11-20 15:42:52 +00:00
parent 81b576acad
commit 99b7d8a66f
11 changed files with 380 additions and 1 deletions

View File

@@ -1293,6 +1293,21 @@ class ConfirmPasswordForm(StripWhitespaceForm):
raise ValidationError('Invalid password')
class NewBroadcastForm(StripWhitespaceForm):
content = GovukRadiosField(
"How to do you want to add content to the alert?",
choices=[
('freeform', 'Write your own message'),
('template', 'Use a template'),
],
param_extensions={'fieldset': {'legend': {'classes': 'govuk-visually-hidden'}}}
)
@property
def use_template(self):
return self.content.data == 'template'
class BaseTemplateForm(StripWhitespaceForm):
name = GovukTextInputField(
"Template name",