Let users switch channels on and off by themselves

We let people do this for letters already. We should let them do it for
emails and texts too, rather than have to email us.
This commit is contained in:
Chris Hill-Scott
2019-01-29 14:51:31 +00:00
parent eae0a5a632
commit 3b15b04fc2
8 changed files with 183 additions and 105 deletions

View File

@@ -696,10 +696,18 @@ class ServiceLetterContactBlockForm(StripWhitespaceForm):
)
class ServiceSwitchLettersForm(StripWhitespaceForm):
class ServiceSwitchChannelForm(StripWhitespaceForm):
def __init__(self, channel, *args, **kwargs):
super().__init__(*args, **kwargs)
self.enabled.label.text = 'Send {}'.format({
'email': 'emails',
'sms': 'text messages',
'letter': 'letters',
}.get(channel))
enabled = RadioField(
'Send letters',
'Choices',
choices=[
('on', 'On'),
('off', 'Off'),