mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 04:09:07 -04:00
Use separate classes for branding option forms
These are about to become a lot less similar to each other when we add email branding pools. Note that the optional *args and *kwargs weren't used anywhere.
This commit is contained in:
@@ -2180,7 +2180,7 @@ class LinkOrganisationsForm(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
|
||||
class BrandingOptions(StripWhitespaceForm):
|
||||
class ChooseBrandingForm(StripWhitespaceForm):
|
||||
|
||||
FALLBACK_OPTION_VALUE = 'something_else'
|
||||
FALLBACK_OPTION = (FALLBACK_OPTION_VALUE, 'Something else')
|
||||
@@ -2188,8 +2188,8 @@ class BrandingOptions(StripWhitespaceForm):
|
||||
options = RadioField('Choose your new branding')
|
||||
something_else = TextAreaField('Describe the branding you want')
|
||||
|
||||
def __init__(self, service, *args, branding_type="email", **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
def __init__(self, service, branding_type):
|
||||
super().__init__()
|
||||
self.branding_type = branding_type
|
||||
self.options.choices = tuple(self.get_available_choices(service, branding_type))
|
||||
self.options.label.text = 'Choose your new {} branding'.format(branding_type)
|
||||
@@ -2248,7 +2248,7 @@ class BrandingOptions(StripWhitespaceForm):
|
||||
):
|
||||
yield ('organisation', service.organisation.name)
|
||||
|
||||
yield BrandingOptions.FALLBACK_OPTION
|
||||
yield ChooseBrandingForm.FALLBACK_OPTION
|
||||
|
||||
@property
|
||||
def something_else_is_only_option(self):
|
||||
@@ -2266,6 +2266,16 @@ class BrandingOptions(StripWhitespaceForm):
|
||||
field.data = ''
|
||||
|
||||
|
||||
class ChooseEmailBrandingForm(ChooseBrandingForm):
|
||||
def __init__(self, service_id):
|
||||
ChooseBrandingForm.__init__(self, service_id, branding_type='email')
|
||||
|
||||
|
||||
class ChooseLetterBrandingForm(ChooseBrandingForm):
|
||||
def __init__(self, service_id):
|
||||
ChooseBrandingForm.__init__(self, service_id, branding_type='letter')
|
||||
|
||||
|
||||
class SomethingElseBrandingForm(StripWhitespaceForm):
|
||||
something_else = GovukTextareaField(
|
||||
'Describe the branding you want',
|
||||
|
||||
Reference in New Issue
Block a user