mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 05:29:38 -04:00
Add brand type to email branding.
Removed banner_colour and single_id_colour. We only really need one colour now.
This commit is contained in:
@@ -728,6 +728,16 @@ class ServiceSelectEmailBranding(StripWhitespaceForm):
|
||||
|
||||
|
||||
class ServiceUpdateEmailBranding(StripWhitespaceForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.brand_type.choices = filter(None, [
|
||||
('govuk', 'GOV.UK only'),
|
||||
('both', 'GOV.UK and branding'),
|
||||
('org', 'Branding only'),
|
||||
('org_banner', 'Branding banner'),
|
||||
])
|
||||
|
||||
name = StringField('Name of brand')
|
||||
text = StringField('Text')
|
||||
@@ -738,19 +748,10 @@ class ServiceUpdateEmailBranding(StripWhitespaceForm):
|
||||
Regexp(regex="^$|^#(?:[0-9a-fA-F]{3}){1,2}$", message='Must be a valid color hex code')
|
||||
]
|
||||
)
|
||||
banner_colour = StringField(
|
||||
'Banner colour',
|
||||
validators=[
|
||||
Regexp(regex="^$|^#(?:[0-9a-fA-F]{3}){1,2}$", message='Must be a valid color hex code')
|
||||
]
|
||||
)
|
||||
single_id_colour = StringField(
|
||||
'Single identity colour',
|
||||
validators=[
|
||||
Regexp(regex="^$|^#(?:[0-9a-fA-F]{3}){1,2}$", message='Must be a valid color hex code')
|
||||
]
|
||||
)
|
||||
file = FileField_wtf('Upload a PNG logo', validators=[FileAllowed(['png'], 'PNG Images only!')])
|
||||
brand_type = RadioField(
|
||||
"Brand type"
|
||||
)
|
||||
|
||||
|
||||
class CreateOrUpdateOrganisation(StripWhitespaceForm):
|
||||
|
||||
@@ -51,7 +51,13 @@ def email_branding():
|
||||
def update_email_branding(branding_id, logo=None):
|
||||
email_branding = email_branding_client.get_email_branding(branding_id)['email_branding']
|
||||
|
||||
form = ServiceUpdateEmailBranding()
|
||||
form = ServiceUpdateEmailBranding(
|
||||
name=email_branding['name'],
|
||||
text=email_branding['text'],
|
||||
colour=email_branding['colour'],
|
||||
domain=email_branding['domain'],
|
||||
brand_type=email_branding['brand_type']
|
||||
)
|
||||
|
||||
logo = logo if logo else email_branding.get('logo') if email_branding else None
|
||||
|
||||
@@ -80,20 +86,12 @@ def update_email_branding(branding_id, logo=None):
|
||||
name=form.name.data,
|
||||
text=form.text.data,
|
||||
colour=form.colour.data,
|
||||
banner_colour=form.banner_colour.data,
|
||||
single_id_colour=form.single_id_colour.data,
|
||||
domain=form.domain.data,
|
||||
brand_type=form.brand_type.data,
|
||||
)
|
||||
|
||||
return redirect(url_for('.email_branding', branding_id=branding_id))
|
||||
|
||||
form.name.data = email_branding['name']
|
||||
form.text.data = email_branding['text']
|
||||
form.colour.data = email_branding['colour']
|
||||
form.banner_colour.data = email_branding['banner_colour']
|
||||
form.single_id_colour.data = email_branding['single_id_colour']
|
||||
form.domain.data = email_branding['domain']
|
||||
|
||||
return render_template(
|
||||
'views/email-branding/manage-branding.html',
|
||||
form=form,
|
||||
@@ -134,9 +132,8 @@ def create_email_branding(logo=None):
|
||||
name=form.name.data,
|
||||
text=form.text.data,
|
||||
colour=form.colour.data,
|
||||
banner_colour=form.banner_colour.data,
|
||||
single_id_colour=form.single_id_colour.data,
|
||||
domain=form.domain.data
|
||||
domain=form.domain.data,
|
||||
brand_type=form.brand_type.data,
|
||||
)
|
||||
|
||||
return redirect(url_for('.email_branding'))
|
||||
|
||||
Reference in New Issue
Block a user