mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
use new letter branding instead of dvla organisation id
new code is copied stylistically from the email branding patterns. Instead of `service.dvla_organisation`, there's now `service.letter_branding` and `service.letter_branding_id`. However, unlike email branding we're not currently showing a preview of the logo. That can come later when we work out how we want to do it.
This commit is contained in:
@@ -807,6 +807,11 @@ class ServiceSetEmailBranding(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
|
||||
class ServiceSetLetterBranding(ServiceSetEmailBranding):
|
||||
# form is the same, but instead of GOV.UK we have None as a valid option
|
||||
DEFAULT = (FieldWithNoneOption.NONE_OPTION_VALUE, 'None')
|
||||
|
||||
|
||||
class ServicePreviewBranding(StripWhitespaceForm):
|
||||
|
||||
branding_style = HiddenFieldWithNoneOption('branding_style')
|
||||
|
||||
@@ -46,6 +46,7 @@ from app.main.forms import (
|
||||
ServicePreviewBranding,
|
||||
ServiceReplyToEmailForm,
|
||||
ServiceSetEmailBranding,
|
||||
ServiceSetLetterBranding,
|
||||
ServiceSmsSenderForm,
|
||||
ServiceSwitchChannelForm,
|
||||
SMSPrefixForm,
|
||||
@@ -805,16 +806,17 @@ def service_preview_email_branding(service_id):
|
||||
@main.route("/services/<service_id>/service-settings/set-letter-branding", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def set_letter_branding(service_id):
|
||||
def service_set_letter_branding(service_id):
|
||||
letter_branding = letter_branding_client.get_all_letter_branding()
|
||||
|
||||
form = LetterBranding(
|
||||
choices=letter_branding_client.get_letter_branding().items(),
|
||||
dvla_org_id=current_service.dvla_organisation,
|
||||
form = ServiceSetLetterBranding(
|
||||
all_branding_options=get_branding_as_value_and_label(letter_branding),
|
||||
current_branding=current_service.letter_branding_id,
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.update(
|
||||
dvla_organisation=form.dvla_org_id.data
|
||||
letter_branding=form.branding_style.data
|
||||
)
|
||||
return redirect(url_for('.service_settings', service_id=service_id))
|
||||
|
||||
@@ -822,6 +824,7 @@ def set_letter_branding(service_id):
|
||||
'views/service-settings/set-letter-branding.html',
|
||||
form=form,
|
||||
search_form=SearchTemplatesForm(),
|
||||
show_search_box=(len(letter_branding) > 6)
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user