diff --git a/app/helpers/question_view_helper.rb b/app/helpers/question_view_helper.rb index ecf29e574..5d85b2fa7 100644 --- a/app/helpers/question_view_helper.rb +++ b/app/helpers/question_view_helper.rb @@ -1,8 +1,8 @@ module QuestionViewHelper - def caption(caption, page_header, conditional) - return nil unless caption && page_header.blank? && !conditional + def caption(caption_text, page_header, conditional) + return nil unless caption_text && page_header.blank? && !conditional - { text: caption.html_safe, size: "l" } + { text: caption_text.html_safe, size: "l" } end def legend(question, page_header, conditional) diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb index 97120a5cd..4ac23267b 100644 --- a/app/views/form/_checkbox_question.html.erb +++ b/app/views/form/_checkbox_question.html.erb @@ -1,7 +1,7 @@ <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= f.govuk_check_boxes_fieldset question.id.to_sym, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), legend: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe } do %> diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb index d71db38e4..c453e1019 100644 --- a/app/views/form/_date_question.html.erb +++ b/app/views/form/_date_question.html.erb @@ -1,7 +1,7 @@ <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= f.govuk_date_field question.id.to_sym, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), legend: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe }, width: 20, diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb index 8356a121f..606d2294c 100644 --- a/app/views/form/_numeric_question.html.erb +++ b/app/views/form/_numeric_question.html.erb @@ -1,7 +1,7 @@ <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= f.govuk_number_field question.id.to_sym, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), label: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe }, min: question.min, max: question.max, step: question.step, diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb index 83cf9f101..9a625ef76 100644 --- a/app/views/form/_radio_question.html.erb +++ b/app/views/form/_radio_question.html.erb @@ -1,7 +1,7 @@ <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= f.govuk_radio_buttons_fieldset question.id.to_sym, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), legend: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe } do %> @@ -16,7 +16,7 @@ <%= f.govuk_radio_button question.id, val, label: { text: val }, **stimulus_html_attributes(question) do %> <%= render partial: "#{conditional_question.type}_question", locals: { question: conditional_question, - caption: caption, + caption_text: caption_text, page_header: page_header, f: f, conditional: true diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb index e02142869..ad986ac95 100644 --- a/app/views/form/_select_question.html.erb +++ b/app/views/form/_select_question.html.erb @@ -6,7 +6,7 @@ answers, :id, :name, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), label: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe }, options: { disabled: [""], selected: selected }, diff --git a/app/views/form/_text_question.html.erb b/app/views/form/_text_question.html.erb index 11bf9ad18..1fb67b84a 100644 --- a/app/views/form/_text_question.html.erb +++ b/app/views/form/_text_question.html.erb @@ -1,7 +1,7 @@ <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= f.govuk_text_field question.id.to_sym, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), label: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe }, width: question.width ? question.width : nil, diff --git a/app/views/form/_textarea_question.html.erb b/app/views/form/_textarea_question.html.erb index 8ac2e44d7..59a8ca163 100644 --- a/app/views/form/_textarea_question.html.erb +++ b/app/views/form/_textarea_question.html.erb @@ -1,7 +1,7 @@ <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= f.govuk_text_area question.id.to_sym, - caption: caption(caption, page_header, conditional), + caption: caption(caption_text, page_header, conditional), label: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe }, width: question.width ? question.width : nil, diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index e2ec34dc8..3589a1c43 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -36,7 +36,7 @@ <% if question.read_only? %>