mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Merge pull request #2235 from alphagov/sort-branding-radios-alphabetically
Sort branding radios alphabetically
This commit is contained in:
@@ -26,10 +26,11 @@ from app.utils import get_cdn_domain, user_is_platform_admin
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def email_branding():
|
||||
brandings = email_branding_client.get_all_email_branding()
|
||||
brandings = email_branding_client.get_all_email_branding(sort_key='name')
|
||||
|
||||
form = ServiceSelectEmailBranding()
|
||||
form.email_branding.choices = get_branding_as_value_and_label(brandings) + [('None', 'Create a new email branding')]
|
||||
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':
|
||||
|
||||
@@ -872,7 +872,9 @@ def service_set_email_branding(service_id):
|
||||
form = ServiceSetBranding(branding_type=branding_type)
|
||||
|
||||
# dynamically create org choices, including the null option
|
||||
form.branding_style.choices = [('None', 'None')] + get_branding_as_value_and_label(email_branding)
|
||||
email_brandings = sorted(get_branding_as_value_and_label(email_branding),
|
||||
key=lambda tup: tup[1].lower())
|
||||
form.branding_style.choices = [('None', 'None')] + email_brandings
|
||||
|
||||
if form.validate_on_submit():
|
||||
branding_style = None if form.branding_style.data == 'None' else form.branding_style.data
|
||||
|
||||
Reference in New Issue
Block a user