mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge branch 'master' into add-brand-type-to-email-branding
This commit is contained in:
@@ -713,20 +713,6 @@ class ServicePreviewBranding(StripWhitespaceForm):
|
||||
branding_style = HiddenField('branding_style')
|
||||
|
||||
|
||||
class ServiceSelectEmailBranding(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, email_brandings=[], *args, **kwargs):
|
||||
self.email_branding.choices = email_brandings
|
||||
super(ServiceSelectEmailBranding, self).__init__(*args, **kwargs)
|
||||
|
||||
email_branding = RadioField(
|
||||
'Email branding',
|
||||
validators=[
|
||||
DataRequired()
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class ServiceUpdateEmailBranding(StripWhitespaceForm):
|
||||
name = StringField('Name of brand')
|
||||
text = StringField('Text')
|
||||
|
||||
@@ -3,10 +3,7 @@ from flask_login import login_required
|
||||
|
||||
from app import email_branding_client
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
ServiceSelectEmailBranding,
|
||||
ServiceUpdateEmailBranding,
|
||||
)
|
||||
from app.main.forms import SearchTemplatesForm, ServiceUpdateEmailBranding
|
||||
from app.main.s3_client import (
|
||||
TEMP_TAG,
|
||||
delete_temp_file,
|
||||
@@ -14,10 +11,7 @@ from app.main.s3_client import (
|
||||
persist_logo,
|
||||
upload_logo,
|
||||
)
|
||||
from app.main.views.service_settings import (
|
||||
get_branding_as_dict,
|
||||
get_branding_as_value_and_label,
|
||||
)
|
||||
from app.main.views.service_settings import get_branding_as_value_and_label
|
||||
from app.utils import get_cdn_domain, user_is_platform_admin
|
||||
|
||||
|
||||
@@ -27,19 +21,11 @@ from app.utils import get_cdn_domain, user_is_platform_admin
|
||||
def email_branding():
|
||||
brandings = email_branding_client.get_all_email_branding(sort_key='name')
|
||||
|
||||
form = ServiceSelectEmailBranding()
|
||||
email_brandings = get_branding_as_value_and_label(brandings)
|
||||
form.email_branding.choices = email_brandings + [('None', 'Create a new email branding')]
|
||||
if form.validate_on_submit():
|
||||
if form.email_branding.data != 'None':
|
||||
return redirect(url_for('.update_email_branding', branding_id=form.email_branding.data))
|
||||
else:
|
||||
return redirect(url_for('.create_email_branding'))
|
||||
|
||||
return render_template(
|
||||
'views/email-branding/select-branding.html',
|
||||
form=form,
|
||||
branding_dict=get_branding_as_dict(brandings),
|
||||
email_brandings=get_branding_as_value_and_label(brandings),
|
||||
search_form=SearchTemplatesForm(),
|
||||
show_search_box=len(brandings) > 9,
|
||||
)
|
||||
|
||||
|
||||
@@ -106,6 +92,7 @@ def update_email_branding(branding_id, logo=None):
|
||||
@user_is_platform_admin
|
||||
def create_email_branding(logo=None):
|
||||
form = ServiceUpdateEmailBranding()
|
||||
|
||||
if form.validate_on_submit():
|
||||
if form.file.data:
|
||||
upload_filename = upload_logo(
|
||||
|
||||
@@ -34,6 +34,7 @@ from app.main.forms import (
|
||||
OrganisationTypeForm,
|
||||
RenameServiceForm,
|
||||
RequestToGoLiveForm,
|
||||
SearchTemplatesForm,
|
||||
ServiceContactDetailsForm,
|
||||
ServiceDataRetentionEditForm,
|
||||
ServiceDataRetentionForm,
|
||||
@@ -886,7 +887,9 @@ def service_set_email_branding(service_id):
|
||||
return render_template(
|
||||
'views/service-settings/set-email-branding.html',
|
||||
form=form,
|
||||
branding_dict=get_branding_as_dict(email_branding)
|
||||
branding_dict=get_branding_as_dict(email_branding),
|
||||
search_form=SearchTemplatesForm(),
|
||||
show_search_box=(len(email_branding) > 6)
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user