From 2dd5c53785f588b7f6018ac4a49b439338086146 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Fri, 22 Nov 2024 15:26:53 +0000 Subject: [PATCH 1/7] Remove empty link --- app/views/layouts/application.html.erb | 6 ------ app/views/layouts/govuk_template.html.erb | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 72b0a3d10..b73e4730c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,12 +9,6 @@ <%= render partial: 'layouts/gtm_noscript' if analytics_allowed? %> <% end %> -<% content_for(:service_name) do %> - <%= link_to service_name, root_path, - class: 'govuk-header__link govuk-header__service-name ga-pageLink', - data: { ga_category: 'header', ga_label: 'service name' }, id: 'header-service-name' %> -<% end %> - <% content_for(:cookie_banner) do %> <% unless analytics_consent_cookie.present? %> <%= render partial: 'layouts/cookie_banner' %> diff --git a/app/views/layouts/govuk_template.html.erb b/app/views/layouts/govuk_template.html.erb index 776453baa..a9989f8ca 100644 --- a/app/views/layouts/govuk_template.html.erb +++ b/app/views/layouts/govuk_template.html.erb @@ -34,7 +34,7 @@ <%= content_for?(:skip_link_message) ? yield(:skip_link_message) : 'Skip to main content' %> -<%= govuk_header(homepage_url: "https://www.gov.uk", service_name: yield(:service_name), service_url: "#") %> +<%= govuk_header(homepage_url: "https://www.gov.uk", service_name:, service_url: "/") %>
<%= yield(:phase_banner) %> From f60a58091707ffa8f25746b81ce50282ea4d65e6 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Fri, 22 Nov 2024 15:36:54 +0000 Subject: [PATCH 2/7] Fix test --- features/multiples/cautions_and_convictions.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/multiples/cautions_and_convictions.feature b/features/multiples/cautions_and_convictions.feature index f658a74b7..151a57168 100644 --- a/features/multiples/cautions_and_convictions.feature +++ b/features/multiples/cautions_and_convictions.feature @@ -53,7 +53,7 @@ Feature: A person with cautions and convictions # And I should see "Check your answers" # Check in progress warning quick smoke test - When I click the "header-service-name" link + When I click the "Check when to disclose cautions or convictions" link Then I should see "This tool is being updated" When I click "Continue" link Then I should see "It looks like you already have a check in progress" From 40ff67a257ebf2e7f9861b1b45f30c9705dae149 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Fri, 22 Nov 2024 16:05:32 +0000 Subject: [PATCH 3/7] Add link to feedback page --- app/views/steps/check/results/shared/_feedback.en.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/steps/check/results/shared/_feedback.en.html.erb b/app/views/steps/check/results/shared/_feedback.en.html.erb index c880f5996..83c32b6e9 100644 --- a/app/views/steps/check/results/shared/_feedback.en.html.erb +++ b/app/views/steps/check/results/shared/_feedback.en.html.erb @@ -5,7 +5,7 @@

- This will help us to improve the service. + <%= link_to "Get in touch", about_contact_path %> to help us improve the service.

From 9101f8adc42055ab261a606f110dbb826da55773 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Fri, 22 Nov 2024 16:32:27 +0000 Subject: [PATCH 4/7] Swap order --- features/fixtures/files/steps_conviction_known_date.html | 2 +- .../fixtures/files/steps_conviction_known_date_with_errors.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/fixtures/files/steps_conviction_known_date.html b/features/fixtures/files/steps_conviction_known_date.html index 69f5e5a35..d486b6ecf 100644 --- a/features/fixtures/files/steps_conviction_known_date.html +++ b/features/fixtures/files/steps_conviction_known_date.html @@ -1,5 +1,5 @@
-
+

Bind overWhen were you given the order?

diff --git a/features/fixtures/files/steps_conviction_known_date_with_errors.html b/features/fixtures/files/steps_conviction_known_date_with_errors.html index e10f1886f..f219ad4b9 100644 --- a/features/fixtures/files/steps_conviction_known_date_with_errors.html +++ b/features/fixtures/files/steps_conviction_known_date_with_errors.html @@ -1,5 +1,5 @@
-
+

Bind overWhen were you given the order?

From 1f560671b7b2fccc1fdebf2ec38a43699bd2d4be Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Fri, 22 Nov 2024 16:32:39 +0000 Subject: [PATCH 5/7] Fix indentation for clarity --- .../files/steps_conviction_known_date.html | 11 ++-- ...eps_conviction_known_date_with_errors.html | 61 +++++++++++-------- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/features/fixtures/files/steps_conviction_known_date.html b/features/fixtures/files/steps_conviction_known_date.html index d486b6ecf..1ca0bb811 100644 --- a/features/fixtures/files/steps_conviction_known_date.html +++ b/features/fixtures/files/steps_conviction_known_date.html @@ -4,12 +4,13 @@

Bind overWhen were you given the order?

-

This is usually the day you were convicted in court. -

+
+

This is usually the day you were convicted in court.

+
-
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. -

For example, 23 9 2018

-
+
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. +

For example, 23 9 2018

+
diff --git a/features/fixtures/files/steps_conviction_known_date_with_errors.html b/features/fixtures/files/steps_conviction_known_date_with_errors.html index f219ad4b9..3e7b38a53 100644 --- a/features/fixtures/files/steps_conviction_known_date_with_errors.html +++ b/features/fixtures/files/steps_conviction_known_date_with_errors.html @@ -4,39 +4,48 @@

Bind overWhen were you given the order?

-

This is usually the day you were convicted in court. -

+
+

This is usually the day you were convicted in court.

+
-
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. -

For example, 23 9 2018

-
+
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. +

For example, 23 9 2018

+
-

Error: Enter the date in the format dd/mm/yyyy

-
-
-
- - +

Error: Enter the date in the format dd/mm/yyyy

+
+
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
-
+
-
Approximate date
-
-
+
+
+ Approximate date +
+
+ + +
+
+
+
From cb521785f7f9ab8177c00055af3728e731c6ebf0 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Mon, 25 Nov 2024 10:43:50 +0000 Subject: [PATCH 6/7] Just change aria-describedby order --- .../files/steps_conviction_known_date.html | 11 ++-- ...eps_conviction_known_date_with_errors.html | 61 ++++++++----------- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/features/fixtures/files/steps_conviction_known_date.html b/features/fixtures/files/steps_conviction_known_date.html index 1ca0bb811..d486b6ecf 100644 --- a/features/fixtures/files/steps_conviction_known_date.html +++ b/features/fixtures/files/steps_conviction_known_date.html @@ -4,13 +4,12 @@

Bind overWhen were you given the order?

-
-

This is usually the day you were convicted in court.

-
+

This is usually the day you were convicted in court. +

-
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. -

For example, 23 9 2018

-
+
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. +

For example, 23 9 2018

+
diff --git a/features/fixtures/files/steps_conviction_known_date_with_errors.html b/features/fixtures/files/steps_conviction_known_date_with_errors.html index 3e7b38a53..f219ad4b9 100644 --- a/features/fixtures/files/steps_conviction_known_date_with_errors.html +++ b/features/fixtures/files/steps_conviction_known_date_with_errors.html @@ -4,48 +4,39 @@

Bind overWhen were you given the order?

-
-

This is usually the day you were convicted in court.

-
- -
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. -

For example, 23 9 2018

-
+

This is usually the day you were convicted in court. +

-

Error: Enter the date in the format dd/mm/yyyy

-
-
-
- - -
-
+
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. +

For example, 23 9 2018

+
-
-
- - -
+

Error: Enter the date in the format dd/mm/yyyy

+
+
+
+ +
+
-
-
- - -
+
+
+ +
-
-
-
-
- Approximate date -
-
- - +
+
+ +
-
+
+
+ +
Approximate date
+
+
From 8abc44c8f9290fc4700657cab014cdeb23537996 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Mon, 25 Nov 2024 12:26:31 +0000 Subject: [PATCH 7/7] Add supplemental text to hint --- app/helpers/custom_form_helpers.rb | 7 +++++ .../conditional_end_date/edit.html.erb | 7 +++-- .../compensation_payment_date/edit.html.erb | 6 ++-- .../conviction/conviction_date/edit.html.erb | 7 +++-- .../steps/conviction/known_date/edit.html.erb | 2 +- config/locales/en/helpers.yml | 8 ----- .../files/steps_conviction_known_date.html | 9 +++--- ...eps_conviction_known_date_with_errors.html | 9 +++--- spec/helpers/custom_form_helpers_spec.rb | 30 +++++++++++++++++++ 9 files changed, 57 insertions(+), 28 deletions(-) diff --git a/app/helpers/custom_form_helpers.rb b/app/helpers/custom_form_helpers.rb index d0a3f70fe..24792644a 100644 --- a/app/helpers/custom_form_helpers.rb +++ b/app/helpers/custom_form_helpers.rb @@ -21,6 +21,13 @@ def i18n_legend ) end + def i18n_date_hint(lead_text = i18n_lead_text) + safe_join([ + content_tag(:p, lead_text), + I18n.t("helpers/dictionary.date_hint_text").html_safe, + ]) + end + # Used to customise hints when reusing the same view # Hints support markup so ensure locale keys ends with `_html` def i18n_hint diff --git a/app/views/steps/caution/conditional_end_date/edit.html.erb b/app/views/steps/caution/conditional_end_date/edit.html.erb index 39fbabc9d..d1020cc21 100644 --- a/app/views/steps/caution/conditional_end_date/edit.html.erb +++ b/app/views/steps/caution/conditional_end_date/edit.html.erb @@ -6,9 +6,10 @@ <%= govuk_error_summary %> <%= step_form @form_object do |f| %> - <%= f.govuk_date_field :conditional_end_date, maxlength_enabled: true, form_group: { class: 'app-util--compact-form-group' } do - tag.p t('.lead_text'), class: 'govuk-body-m' - end %> + <%= f.govuk_date_field :conditional_end_date, maxlength_enabled: true, + form_group: { class: 'app-util--compact-form-group' }, + hint: { text: f.i18n_date_hint(t('.lead_text')) } + %> <%= render partial: 'steps/shared/approx_date_checkbox', locals: { form: f, attribute: :approximate_conditional_end_date diff --git a/app/views/steps/conviction/compensation_payment_date/edit.html.erb b/app/views/steps/conviction/compensation_payment_date/edit.html.erb index 7ce054cf7..dd04643a9 100644 --- a/app/views/steps/conviction/compensation_payment_date/edit.html.erb +++ b/app/views/steps/conviction/compensation_payment_date/edit.html.erb @@ -8,9 +8,9 @@ <%= step_form @form_object do |f| %> <%= f.govuk_date_field :compensation_payment_date, maxlength_enabled: true, form_group: { class: 'app-util--compact-form-group' }, - caption: { text: f.i18n_caption } do - tag.p t('.lead_text'), class: 'govuk-body-m' - end %> + caption: { text: f.i18n_caption }, + hint: { text: f.i18n_date_hint(t('.lead_text')) } + %> <%= render partial: 'steps/shared/approx_date_checkbox', locals: { form: f, attribute: :approximate_compensation_payment_date diff --git a/app/views/steps/conviction/conviction_date/edit.html.erb b/app/views/steps/conviction/conviction_date/edit.html.erb index 4c652f7ae..b071bc041 100644 --- a/app/views/steps/conviction/conviction_date/edit.html.erb +++ b/app/views/steps/conviction/conviction_date/edit.html.erb @@ -6,9 +6,10 @@ <%= govuk_error_summary %> <%= step_form @form_object do |f| %> - <%= f.govuk_date_field :conviction_date, maxlength_enabled: true, form_group: { class: 'app-util--compact-form-group' } do - tag.p t('.lead_text'), class: 'govuk-body-m' - end %> + <%= f.govuk_date_field :conviction_date, maxlength_enabled: true, + form_group: { class: 'app-util--compact-form-group' }, + hint: { text: f.i18n_date_hint(t('.lead_text')) } + %> <%= render partial: 'steps/shared/approx_date_checkbox', locals: { form: f, attribute: :approximate_conviction_date diff --git a/app/views/steps/conviction/known_date/edit.html.erb b/app/views/steps/conviction/known_date/edit.html.erb index 503973d3f..6490f6ece 100644 --- a/app/views/steps/conviction/known_date/edit.html.erb +++ b/app/views/steps/conviction/known_date/edit.html.erb @@ -8,9 +8,9 @@ <%= step_form @form_object do |f| %> <%= f.govuk_date_field :known_date, maxlength_enabled: true, form_group: { class: 'app-util--compact-form-group' }, + hint: { text: f.i18n_date_hint }, legend: { text: f.i18n_legend }, caption: { text: f.i18n_caption } do - tag.p f.i18n_lead_text, class: 'govuk-body-m' end %> <%= render partial: 'steps/shared/approx_date_checkbox', locals: { diff --git a/config/locales/en/helpers.yml b/config/locales/en/helpers.yml index 35fd3e479..c3eb75b5a 100644 --- a/config/locales/en/helpers.yml +++ b/config/locales/en/helpers.yml @@ -177,14 +177,6 @@ en: steps_check_under_age_form: caution_html: Select your age when you got the caution, not when you committed the offence conviction_html: Select your age when you got convicted, not when you committed the offence - steps_caution_conditional_end_date_form: - conditional_end_date_html: *date_hint_text - steps_conviction_conviction_date_form: - conviction_date_html: *date_hint_text - steps_conviction_known_date_form: - known_date_html: *date_hint_text - steps_conviction_compensation_payment_date_form: - compensation_payment_date_html: *date_hint_text steps_conviction_motoring_endorsement_form: motoring_endorsement: An endorsement means that your conviction is recorded on your driving licence. Endorsements are usually given by courts. steps_conviction_conviction_subtype_form: diff --git a/features/fixtures/files/steps_conviction_known_date.html b/features/fixtures/files/steps_conviction_known_date.html index d486b6ecf..cfe99410a 100644 --- a/features/fixtures/files/steps_conviction_known_date.html +++ b/features/fixtures/files/steps_conviction_known_date.html @@ -1,13 +1,12 @@
-
+

Bind overWhen were you given the order?

-

This is usually the day you were convicted in court. -

- -
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. +
+

This is usually the day you were convicted in court. +

If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate.

For example, 23 9 2018

diff --git a/features/fixtures/files/steps_conviction_known_date_with_errors.html b/features/fixtures/files/steps_conviction_known_date_with_errors.html index f219ad4b9..1a88616b8 100644 --- a/features/fixtures/files/steps_conviction_known_date_with_errors.html +++ b/features/fixtures/files/steps_conviction_known_date_with_errors.html @@ -1,13 +1,12 @@
-
+

Bind overWhen were you given the order?

-

This is usually the day you were convicted in court. -

- -
If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate. +
+

This is usually the day you were convicted in court. +

If you do not know the exact date, you can enter an approximate one. However, if you use an approximate date, your results will be approximate.

For example, 23 9 2018

diff --git a/spec/helpers/custom_form_helpers_spec.rb b/spec/helpers/custom_form_helpers_spec.rb index efb09f8d7..6b60fe4a2 100644 --- a/spec/helpers/custom_form_helpers_spec.rb +++ b/spec/helpers/custom_form_helpers_spec.rb @@ -85,6 +85,36 @@ end end + describe "#i18n_date_hint" do + let(:found_key) { "hint text about dates" } + + before do + allow(I18n).to receive(:t).with( + "helpers/dictionary.date_hint_text", + ).and_return(found_key) + end + + describe "with lead_text argument" do + it "seeks the expected key" do + expect(found_key).to receive(:html_safe) + + builder.i18n_date_hint("lead text") + end + + it "wraps lead text in p tags" do + expect(builder.i18n_date_hint("lead text")).to include "

lead text

" + end + end + + describe "without lead_text argument" do + it "gets lead text from i18n_lead_text" do + allow(builder).to receive(:i18n_lead_text).and_return "i18n_lead_text" + + expect(builder.i18n_date_hint).to include "

i18n_lead_text

" + end + end + end + describe "#i18n_hint" do let(:found_locale) { instance_double("locale") }