diff --git a/app/main/views/add_service.py b/app/main/views/add_service.py index b1b726189..e5442e7d9 100644 --- a/app/main/views/add_service.py +++ b/app/main/views/add_service.py @@ -80,6 +80,14 @@ def add_service(): template_id=example_sms_template['data']['id'] )) else: + if default_organisation_type == 'local': + return render_template( + 'views/add-service-local.html', + form=form, + heading=heading, + default_organisation_type=default_organisation_type, + ) + return render_template( 'views/add-service.html', form=form, diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index ef8a78117..9aa2257e8 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -104,6 +104,12 @@ def service_name_change(service_id): session['service_name_change'] = form.name.data return redirect(url_for('.service_name_change_confirm', service_id=service_id)) + if current_service.organisation_type == 'local': + return render_template( + 'views/service-settings/name-local.html', + form=form, + ) + return render_template( 'views/service-settings/name.html', form=form, diff --git a/app/templates/views/add-service-local.html b/app/templates/views/add-service-local.html new file mode 100644 index 000000000..427f33e36 --- /dev/null +++ b/app/templates/views/add-service-local.html @@ -0,0 +1,38 @@ +{% extends "withoutnav_template.html" %} +{% from "components/radios.html" import radios %} +{% from "components/textbox.html" import textbox %} +{% from "components/page-header.html" import page_header %} +{% from "components/page-footer.html" import page_footer %} +{% from "components/form.html" import form_wrapper %} + +{% block per_page_title %} + About your service +{% endblock %} + +{% block maincolumn_content %} + +
+
+ + {{ page_header('About your service') }} + +

Give your service a name that tells users what your messages are about, as well as who they’re from. For example:

+ +

You should only use an acronym if your users are already familiar with it.

+ + {% call form_wrapper() %} + + {{ textbox(form.name, hint="You can change this later") }} + + {{ page_footer('Add service') }} + + {% endcall %} + +
+
+ +{% endblock %} diff --git a/app/templates/views/service-settings/name-local.html b/app/templates/views/service-settings/name-local.html new file mode 100644 index 000000000..58cece252 --- /dev/null +++ b/app/templates/views/service-settings/name-local.html @@ -0,0 +1,45 @@ + +{% extends "withnav_template.html" %} +{% from "components/textbox.html" import textbox %} +{% from "components/page-header.html" import page_header %} +{% from "components/page-footer.html" import page_footer %} +{% from "components/form.html" import form_wrapper %} + +{% block service_page_title %} + Change your service name +{% endblock %} + +{% block maincolumn_content %} + + {{ page_header( + 'Change your service name', + back_link=url_for('main.service_settings', service_id=current_service.id) + ) }} + +

Your service name should tell users what the message is about as well as who it’s from. For example:

+ + +

You should only use an acronym if your users are already familiar with it.

+ +
+ {% if current_service.prefix_sms %} +

Users will see your service name:

+ + {% else %} +

Users will see your service name as your email sender name.

+ {% endif %} +
+ + {% call form_wrapper() %} + {{ textbox(form.name) }} + {{ page_footer('Save') }} + {% endcall %} + +{% endblock %} diff --git a/tests/app/main/views/test_add_service.py b/tests/app/main/views/test_add_service.py index 96147d4db..789f7474e 100644 --- a/tests/app/main/views/test_add_service.py +++ b/tests/app/main/views/test_add_service.py @@ -76,6 +76,22 @@ def test_get_should_not_render_radios_if_org_type_known( assert not page.select('.multiple-choice') +def test_show_different_page_if_user_org_type_is_local( + client_request, + mocker, +): + mocker.patch( + 'app.organisations_client.get_organisation_by_domain', + return_value=organisation_json(organisation_type='local'), + ) + page = client_request.get('main.add_service') + assert page.select_one('h1').text.strip() == 'About your service' + assert page.select_one('input[name=name]')['value'] == '' + assert page.select_one('main .govuk-body').text.strip() == ( + 'Give your service a name that tells users what your ' + 'messages are about, as well as who they’re from. For example:') + + @pytest.mark.parametrize('email_address', ( # User’s email address doesn’t matter when the organisation is known 'test@example.gov.uk', diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 028ef989f..3e96b60ab 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -383,6 +383,26 @@ def test_should_show_service_name( app.service_api_client.get_service.assert_called_with(SERVICE_ONE_ID) +def test_should_show_different_change_service_name_page_for_local_services( + client_request, + service_one, + mocker, +): + mocker.patch( + 'app.organisations_client.get_organisation_by_domain', + return_value=organisation_json(organisation_type='local'), + ) + service_one['organisation_type'] = 'local' + page = client_request.get('main.service_name_change', service_id=SERVICE_ONE_ID) + assert page.find('h1').text == 'Change your service name' + assert page.find('input', attrs={"type": "text"})['value'] == 'service one' + assert page.select_one('main .govuk-body').text.strip() == ( + 'Your service name should tell users what the message is about as well as who it’s from. For example:' + ) + + app.service_api_client.get_service.assert_called_with(SERVICE_ONE_ID) + + def test_should_show_service_name_with_no_prefixing( client_request, service_one,