Link directly to email branding "something else"

Previously we duplicated the "something else" email branding form
on its own page and embedded in the choices form (if it was the
only option). See [^1] for how this looks - it's inconsistent.

This DRYs-up the "something else" form by bypassing the choices
form when "something else" is the only option. I've also tweaked
the "Back" button to be consistent with this behaviour.

Making this change also simplifies the choices form, which we'll
be adding pool options to shortly. I'd like to make the letters
form consistent, but let's see how emails pan out first.

Note that the choices form will now show a single radio button if
"something else" is the only option. I think that's OK as nothing
will link to the page, and the form still works.

[^1]: https://github.com/alphagov/notifications-admin/pull/4163#issuecomment-1050088088
This commit is contained in:
Ben Thorner
2022-03-02 15:36:28 +00:00
parent cc876194d0
commit 33c6ca0989
6 changed files with 120 additions and 166 deletions

View File

@@ -92,12 +92,18 @@
}}
{% endcall %}
{% if email_branding_options.something_else_is_only_option %}
{% set email_request_url = url_for('.email_branding_something_else', service_id=current_service.id) %}
{% else %}
{% set email_request_url = url_for('.email_branding_request', service_id=current_service.id) %}
{% endif %}
{% call settings_row(if_has_permission='email') %}
{{ text_field('Email branding') }}
{{ text_field(current_service.email_branding_name) }}
{{ edit_field(
'Change',
url_for('.email_branding_request', service_id=current_service.id),
email_request_url,
permissions=['manage_service'],
suffix='email branding',
)}}

View File

@@ -34,27 +34,13 @@
</p>
{% endif %}
{% if form.something_else_is_only_option %}
{% call form_wrapper() %}
{{ textbox(
form.something_else,
hint='Include links to your brand guidelines or examples of how to use your branding.',
width='1-1',
) }}
<p class="form-group">
Well email you when your branding is ready, or if we need any more information.
</p>
{{ page_footer('Request new branding') }}
{% endcall %}
{% else %}
{% call form_wrapper() %}
{% call select_wrapper(form.options) %}
{% for option in form.options %}
{{ radio(option) }}
{% endfor %}
{% endcall %}
{{ page_footer('Continue') }}
{% endcall %}
{% endif %}
{% call form_wrapper() %}
{% call select_wrapper(form.options) %}
{% for option in form.options %}
{{ radio(option) }}
{% endfor %}
{% endcall %}
{{ page_footer('Continue') }}
{% endcall %}
{% endblock %}

View File

@@ -9,10 +9,14 @@
Describe the branding you want
{% endblock %}
{% if branding_options.something_else_is_only_option %}
{% set back_url = url_for('.service_settings', service_id=current_service.id) %}
{% else %}
{% set back_url = url_for('.email_branding_request', service_id=current_service.id) %}
{% endif %}
{% block backLink %}
{{ govukBackLink({
"href": url_for('.email_branding_request', service_id=current_service.id)
}) }}
{{ govukBackLink({"href": back_url}) }}
{% endblock %}
{% block maincolumn_content %}