mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 02:48:45 -04:00
Split out the govuk and govuk_and_org branding templates
The `.email_branding_govuk` and `.email_branding_govuk_and_org` routes shared a template since the content was the same - the only difference was in the action of the button. However, since the pages will no longer be so similar (e.g. the govuk page will show a preview) this splits them up to use separate templates. It may be the case that when the branding work is complete these pages are fairly similar and we decided that one template between the two endpoints is the best option again.
This commit is contained in:
@@ -1196,7 +1196,7 @@ def email_branding_govuk(service_id):
|
||||
check_branding_allowed_for_service('govuk')
|
||||
|
||||
if request.method == 'POST':
|
||||
create_email_branding_zendesk_ticket(request.form['branding_choice'])
|
||||
create_email_branding_zendesk_ticket('govuk')
|
||||
|
||||
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))
|
||||
@@ -1210,12 +1210,12 @@ def email_branding_govuk_and_org(service_id):
|
||||
check_branding_allowed_for_service('govuk_and_org')
|
||||
|
||||
if request.method == 'POST':
|
||||
create_email_branding_zendesk_ticket(request.form['branding_choice'])
|
||||
create_email_branding_zendesk_ticket('govuk_and_org')
|
||||
|
||||
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/email-branding-govuk.html', with_org=True)
|
||||
return render_template('views/service-settings/branding/email-branding-govuk-org.html')
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/service-settings/email-branding/nhs", methods=['GET', 'POST'])
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
{% from "components/back-link/macro.njk" import govukBackLink %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Before you request new branding
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({
|
||||
"href": url_for('.email_branding_request', service_id=current_service.id)
|
||||
}) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header('Before you request new branding') }}
|
||||
|
||||
<p class="govuk-body">Check that your new branding matches the rest of your service.</p>
|
||||
|
||||
<p class="govuk-body">You can use the GOV.UK logo on your emails if:</p>
|
||||
<ul class="list list-bullet">
|
||||
<li>your website looks like GOV.UK</li>
|
||||
<li>your email links to a website that looks like GOV.UK</li>
|
||||
<li>people get an email from your service after using GOV.UK</li>
|
||||
</ul>
|
||||
|
||||
<p class="govuk-body">
|
||||
You cannot use GOV.UK branding if your organisation is
|
||||
<a class="govuk-link govuk-link--no-visited-state"
|
||||
href="https://www.gov.uk/government/publications/govuk-proposition/govuk-proposition#organisations-independent-from-government">independent
|
||||
from government</a>.
|
||||
</p>
|
||||
|
||||
<p class="govuk-body">We’ll email you once your branding’s ready to use, or if we need any more information.</p>
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{ page_footer('Request new branding') }}
|
||||
{% endcall %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -37,7 +37,7 @@
|
||||
<p class="govuk-body">We’ll email you once your branding’s ready to use, or if we need any more information.</p>
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{ page_footer('Request new branding', button_name='branding_choice', button_value=('govuk_and_org' if with_org else 'govuk')) }}
|
||||
{{ page_footer('Request new branding') }}
|
||||
{% endcall %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -5495,10 +5495,6 @@ def test_get_email_branding_description_pages_give_404_if_selected_branding_not_
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('branding_choice, branding_description', [
|
||||
('govuk', 'GOV.UK'),
|
||||
('govuk_and_org', 'GOV.UK and organisation one'),
|
||||
])
|
||||
def test_submit_email_branding_request_from_govuk_description_page(
|
||||
mocker,
|
||||
client_request,
|
||||
@@ -5508,8 +5504,6 @@ def test_submit_email_branding_request_from_govuk_description_page(
|
||||
no_reply_to_email_addresses,
|
||||
mock_get_email_branding,
|
||||
single_sms_sender,
|
||||
branding_choice,
|
||||
branding_description,
|
||||
):
|
||||
mocker.patch(
|
||||
'app.organisations_client.get_organisation',
|
||||
@@ -5531,7 +5525,6 @@ def test_submit_email_branding_request_from_govuk_description_page(
|
||||
page = client_request.post(
|
||||
'.email_branding_govuk',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_data={'branding_choice': branding_choice},
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
@@ -5544,7 +5537,66 @@ def test_submit_email_branding_request_from_govuk_description_page(
|
||||
'',
|
||||
'---',
|
||||
'Current branding: Organisation name',
|
||||
f'Branding requested: {branding_description}\n',
|
||||
'Branding requested: GOV.UK\n',
|
||||
]),
|
||||
subject='Email branding request - service one',
|
||||
ticket_type='question',
|
||||
user_name='Test User',
|
||||
user_email='test@user.gov.uk',
|
||||
org_id=ORGANISATION_ID,
|
||||
org_type='central',
|
||||
service_id=SERVICE_ONE_ID
|
||||
)
|
||||
mock_send_ticket_to_zendesk.assert_called_once()
|
||||
assert normalize_spaces(page.select_one('.banner-default').text) == (
|
||||
'Thanks for your branding request. We’ll get back to you '
|
||||
'within one working day.'
|
||||
)
|
||||
|
||||
|
||||
def test_submit_email_branding_request_from_govuk_and_org_description_page(
|
||||
mocker,
|
||||
client_request,
|
||||
service_one,
|
||||
organisation_one,
|
||||
mock_get_service_settings_page_common,
|
||||
no_reply_to_email_addresses,
|
||||
mock_get_email_branding,
|
||||
single_sms_sender,
|
||||
):
|
||||
mocker.patch(
|
||||
'app.organisations_client.get_organisation',
|
||||
return_value=organisation_one,
|
||||
)
|
||||
mocker.patch(
|
||||
'app.models.service.Service.organisation_id',
|
||||
new_callable=PropertyMock,
|
||||
return_value=ORGANISATION_ID,
|
||||
)
|
||||
service_one['email_branding'] = sample_uuid()
|
||||
|
||||
mock_create_ticket = mocker.spy(NotifySupportTicket, '__init__')
|
||||
mock_send_ticket_to_zendesk = mocker.patch(
|
||||
'app.main.views.service_settings.zendesk_client.send_ticket_to_zendesk',
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
page = client_request.post(
|
||||
'.email_branding_govuk_and_org',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
mock_create_ticket.assert_called_once_with(
|
||||
ANY,
|
||||
message='\n'.join([
|
||||
'Organisation: organisation one',
|
||||
'Service: service one',
|
||||
'http://localhost/services/596364a0-858e-42c8-9062-a8fe822260eb',
|
||||
'',
|
||||
'---',
|
||||
'Current branding: Organisation name',
|
||||
'Branding requested: GOV.UK and organisation one\n',
|
||||
]),
|
||||
subject='Email branding request - service one',
|
||||
ticket_type='question',
|
||||
|
||||
Reference in New Issue
Block a user