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/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) %> 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/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.

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 69f5e5a35..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 e10f1886f..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/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" 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") }