diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb index b327e94d2..fa838293f 100644 --- a/app/views/form/_checkbox_question.html.erb +++ b/app/views/form/_checkbox_question.html.erb @@ -1,5 +1,6 @@ <%= f.govuk_check_boxes_fieldset question.id.to_sym, - legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" }, + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + legend: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, hint: { text: question.hint_text } do %> <% question.answer_options.map do |key, val| %> diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb index 61eb34b2a..8ad0b459c 100644 --- a/app/views/form/_date_question.html.erb +++ b/app/views/form/_date_question.html.erb @@ -1,6 +1,7 @@ <%= f.govuk_date_field question.id.to_sym, + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + legend: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, hint: { text: question.hint_text }, - legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" }, width: 20, **stimulus_html_attributes(question) %> diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb index 5a75c46c8..2362c74b6 100644 --- a/app/views/form/_numeric_question.html.erb +++ b/app/views/form/_numeric_question.html.erb @@ -1,7 +1,8 @@ <%= f.govuk_number_field question.id.to_sym, + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + label: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, hint: { text: question.hint_text }, - label: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" }, min: question.min, max: question.max, step: question.step, - width: 20, :readonly => question.read_only?, + width: question.width, :readonly => question.read_only?, **stimulus_html_attributes(question) %> diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb index a922fc3e0..f92bfac13 100644 --- a/app/views/form/_radio_question.html.erb +++ b/app/views/form/_radio_question.html.erb @@ -1,7 +1,7 @@ <%= f.govuk_radio_buttons_fieldset question.id.to_sym, - legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" }, - hint: { text: question.hint_text }, - small: (question.answer_options.size > 5) do %> + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + legend: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, + hint: { text: question.hint_text } do %> <% question.answer_options.map do |key, val| %> <% if key.starts_with?("divider") %> diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb index b6c431286..a010c8adb 100644 --- a/app/views/form/_select_question.html.erb +++ b/app/views/form/_select_question.html.erb @@ -3,6 +3,7 @@ answers, :name, :name, - label: { text: question.header, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" }, + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + label: { text: question.header, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, hint: { text: question.hint_text } %> diff --git a/app/views/form/_text_question.html.erb b/app/views/form/_text_question.html.erb index c062b7e62..6d5b015af 100644 --- a/app/views/form/_text_question.html.erb +++ b/app/views/form/_text_question.html.erb @@ -1,6 +1,7 @@ <%= f.govuk_text_field question.id.to_sym, + caption: caption && !page_header.present? ? { text: caption.html_safe, size: "l" } : nil, + label: { text: question.header.html_safe, size: !page_header.present? ? "l" : "m", tag: !page_header.present? ? "h1" : "h2" }, hint: { text: question.hint_text }, - label: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" }, - width: 20, + width: question.width ? question.width : nil, **stimulus_html_attributes(question) %> diff --git a/app/views/form/check_answers.html.erb b/app/views/form/check_answers.html.erb index d2a2551d4..55cbeb0de 100644 --- a/app/views/form/check_answers.html.erb +++ b/app/views/form/check_answers.html.erb @@ -1,7 +1,10 @@ <%= turbo_frame_tag "case_log_form", target: "_top" do %>
-

Check the answers you gave for <%= subsection.id.humanize(capitalize: false) %>

+

+ <%= subsection.id.humanize %> + Check your answers +

<%= display_answered_questions_summary(subsection, @case_log) %>
<% subsection.applicable_questions(@case_log).each do |question| %> diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index d3c4dbc29..ef818905b 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -8,11 +8,9 @@ <%= turbo_frame_tag "case_log_form", target: "_top" do %>
- - <%= subsection %> - <% if page.header.present? %>

+ <%= subsection %> <%= page.header %>

<% end %> @@ -20,7 +18,7 @@ <%= f.govuk_error_summary %> <% page.questions.map do |question| %>
<%= display_question_key_div(page, question) %> > - <%= render partial: "form/#{question.type}_question", locals: { question: question, page_header: page.header, f: f } %> + <%= render partial: "form/#{question.type}_question", locals: { question: question, caption: subsection, page_header: page.header, f: f } %>
<% end %> diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index 677a0493f..7e501001a 100644 --- a/spec/features/form/check_answers_page_spec.rb +++ b/spec/features/form/check_answers_page_spec.rb @@ -31,7 +31,7 @@ RSpec.describe "Form Check Answers Page" do context "when the user needs to check their answers for a subsection" do it "can be visited by URL" do visit("case-logs/#{id}/#{subsection}/check-answers") - expect(page).to have_content("Check the answers you gave for #{subsection.tr('-', ' ')}") + expect(page).to have_content("#{subsection.tr('-', ' ').humanize} Check your answers") end let(:last_question_for_subsection) { "household-number-of-other-members" }