mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 14:59:49 -04:00
Split up the branding_request endpoint
The endpoint used to handle both email and letter branding, but this replaces `.branding_request` with `.email_branding_request` and `.letter_branding_request` instead. This is in preparation for changing how email branding works. The `from_template` arg was only possible for letter branding, so I've removed that from the `.email_branding_request` endpoint.
This commit is contained in:
@@ -1130,15 +1130,11 @@ def link_service_to_organisation(service_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/branding-request/<branding_type>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<uuid:service_id>/branding-request/email", methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_service')
|
||||
def branding_request(service_id, branding_type):
|
||||
form = BrandingOptions(current_service, branding_type=branding_type)
|
||||
from_template = request.args.get('from_template')
|
||||
if branding_type == "email":
|
||||
branding_name = current_service.email_branding_name
|
||||
elif branding_type == "letter":
|
||||
branding_name = current_service.letter_branding_name
|
||||
def email_branding_request(service_id):
|
||||
form = BrandingOptions(current_service, branding_type='email')
|
||||
branding_name = current_service.email_branding_name
|
||||
if form.validate_on_submit():
|
||||
ticket_message = render_template(
|
||||
'support-tickets/branding-request.txt',
|
||||
@@ -1147,7 +1143,45 @@ def branding_request(service_id, branding_type):
|
||||
detail=form.something_else.data,
|
||||
)
|
||||
ticket = NotifySupportTicket(
|
||||
subject=f'{branding_type.capitalize()} branding request - {current_service.name}',
|
||||
subject=f'Email branding request - {current_service.name}',
|
||||
message=ticket_message,
|
||||
ticket_type=NotifySupportTicket.TYPE_QUESTION,
|
||||
user_name=current_user.name,
|
||||
user_email=current_user.email_address,
|
||||
org_id=current_service.organisation_id,
|
||||
org_type=current_service.organisation_type,
|
||||
service_id=current_service.id
|
||||
)
|
||||
zendesk_client.send_ticket_to_zendesk(ticket)
|
||||
flash((
|
||||
'Thanks for your branding request. We’ll get back to you '
|
||||
'within one working day.'
|
||||
), 'default')
|
||||
return redirect(url_for('.service_settings', service_id=current_service.id))
|
||||
|
||||
return render_template(
|
||||
'views/service-settings/branding/branding-options.html',
|
||||
form=form,
|
||||
branding_type='email',
|
||||
branding_name=branding_name,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/branding-request/letter", methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_service')
|
||||
def letter_branding_request(service_id):
|
||||
form = BrandingOptions(current_service, branding_type='letter')
|
||||
from_template = request.args.get('from_template')
|
||||
branding_name = current_service.letter_branding_name
|
||||
if form.validate_on_submit():
|
||||
ticket_message = render_template(
|
||||
'support-tickets/branding-request.txt',
|
||||
current_branding=branding_name,
|
||||
branding_requested=dict(form.options.choices)[form.options.data],
|
||||
detail=form.something_else.data,
|
||||
)
|
||||
ticket = NotifySupportTicket(
|
||||
subject=f'Letter branding request - {current_service.name}',
|
||||
message=ticket_message,
|
||||
ticket_type=NotifySupportTicket.TYPE_QUESTION,
|
||||
user_name=current_user.name,
|
||||
@@ -1168,7 +1202,7 @@ def branding_request(service_id, branding_type):
|
||||
return render_template(
|
||||
'views/service-settings/branding/branding-options.html',
|
||||
form=form,
|
||||
branding_type=branding_type,
|
||||
branding_type='letter',
|
||||
branding_name=branding_name,
|
||||
from_template=from_template
|
||||
)
|
||||
|
||||
@@ -219,8 +219,9 @@ class MainNavigation(Navigation):
|
||||
'settings': {
|
||||
'add_organisation_from_gp_service',
|
||||
'add_organisation_from_nhs_local_service',
|
||||
'branding_request',
|
||||
'email_branding_request',
|
||||
'estimate_usage',
|
||||
'letter_branding_request',
|
||||
'link_service_to_organisation',
|
||||
'request_to_go_live',
|
||||
'service_add_email_reply_to',
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
{{ text_field(current_service.email_branding_name) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.branding_request', service_id=current_service.id, branding_type="email"),
|
||||
url_for('.email_branding_request', service_id=current_service.id),
|
||||
permissions=['manage_service'],
|
||||
suffix='email branding',
|
||||
)}}
|
||||
@@ -257,7 +257,7 @@
|
||||
{{ optional_text_field(current_service.letter_branding.name) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.branding_request', service_id=current_service.id, branding_type="letter"),
|
||||
url_for('.letter_branding_request', service_id=current_service.id),
|
||||
permissions=['manage_service'],
|
||||
suffix='letter branding',
|
||||
)}}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<div class="govuk-grid-column-full template-container">
|
||||
{% if current_user.has_permissions('manage_templates') and template.template_type == 'letter' %}
|
||||
{% if not current_service.letter_branding_id %}
|
||||
<a href="{{ url_for(".branding_request", service_id=current_service.id, branding_type="letter", from_template=template.id) }}" class="govuk-link govuk-link--no-visited-state edit-template-link-letter-branding">Add logo</a>
|
||||
<a href="{{ url_for(".letter_branding_request", service_id=current_service.id, from_template=template.id) }}" class="govuk-link govuk-link--no-visited-state edit-template-link-letter-branding">Add logo</a>
|
||||
{% endif %}
|
||||
<a href="{{ url_for(".edit_template_postage", service_id=current_service.id, template_id=template.id) }}" class="govuk-link govuk-link--no-visited-state edit-template-link-letter-postage">Change<span class="govuk-visually-hidden"> postage</span></a>
|
||||
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}" class="govuk-link govuk-link--no-visited-state edit-template-link-letter-body">Edit<span class="govuk-visually-hidden"> letter template</span></a>
|
||||
|
||||
Reference in New Issue
Block a user