diff --git a/app/helpers/question_view_helper.rb b/app/helpers/question_view_helper.rb index fdb144c4e..a656344ca 100644 --- a/app/helpers/question_view_helper.rb +++ b/app/helpers/question_view_helper.rb @@ -7,7 +7,7 @@ module QuestionViewHelper def legend(question, page_header, conditional) { - text: [question.question_number_string(conditional:), question.header.html_safe].compact.join(" - "), + text: [question.question_number_string(hidden: conditional || question.hide_question_number_on_page), question.header.html_safe].compact.join(" - "), size: label_size(page_header, conditional, question), tag: label_tag(page_header, conditional), } diff --git a/app/models/form/lettings/questions/address_line1.rb b/app/models/form/lettings/questions/address_line1.rb index 024dc09fe..fa2ac82da 100644 --- a/app/models/form/lettings/questions/address_line1.rb +++ b/app/models/form/lettings/questions/address_line1.rb @@ -4,10 +4,13 @@ class Form::Lettings::Questions::AddressLine1 < ::Form::Question @id = "address_line1" @check_answer_label = "Address" @header = "Address line 1" + @error_label = "Address line 1" @type = "text" @plain_label = true - @check_answer_label = "Q12 - Address lines 1 and 2" + @check_answer_label = "Address lines 1 and 2" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 12 + @hide_question_number_on_page = true end def answer_label(log, _current_user = nil) diff --git a/app/models/form/lettings/questions/county.rb b/app/models/form/lettings/questions/county.rb index 6e1a92426..8eaa410eb 100644 --- a/app/models/form/lettings/questions/county.rb +++ b/app/models/form/lettings/questions/county.rb @@ -5,7 +5,9 @@ class Form::Lettings::Questions::County < ::Form::Question @header = "County (optional)" @type = "text" @plain_label = true - @check_answer_label = "Q12 - County" + @check_answer_label = "County" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 12 + @hide_question_number_on_page = true end end diff --git a/app/models/form/lettings/questions/postcode_for_full_address.rb b/app/models/form/lettings/questions/postcode_for_full_address.rb index 02be46f0d..8f7de5f52 100644 --- a/app/models/form/lettings/questions/postcode_for_full_address.rb +++ b/app/models/form/lettings/questions/postcode_for_full_address.rb @@ -17,7 +17,9 @@ class Form::Lettings::Questions::PostcodeForFullAddress < ::Form::Question }, } @plain_label = true - @check_answer_label = "Q12 - Postcode" + @check_answer_label = "Postcode" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 12 + @hide_question_number_on_page = true end end diff --git a/app/models/form/lettings/questions/town_or_city.rb b/app/models/form/lettings/questions/town_or_city.rb index fe1c0f70d..43aa48625 100644 --- a/app/models/form/lettings/questions/town_or_city.rb +++ b/app/models/form/lettings/questions/town_or_city.rb @@ -5,7 +5,9 @@ class Form::Lettings::Questions::TownOrCity < ::Form::Question @header = "Town or city" @type = "text" @plain_label = true - @check_answer_label = "Q12 - Town or city" + @check_answer_label = "Town or city" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 12 + @hide_question_number_on_page = true end end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 82d3a09b5..838d7d365 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -4,7 +4,7 @@ class Form::Question :conditional_for, :readonly, :answer_options, :page, :check_answer_label, :inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value, :guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived, - :check_answers_card_number, :unresolved_hint_text, :question_number, :plain_label + :check_answers_card_number, :unresolved_hint_text, :question_number, :hide_question_number_on_page, :plain_label, :error_label module GuidancePosition TOP = 1 @@ -41,7 +41,9 @@ class Form::Question @check_answers_card_number = hsh["check_answers_card_number"] || 0 @unresolved_hint_text = hsh["unresolved_hint_text"] @question_number = hsh["question_number"] + @hide_question_number_on_page = hsh["hide_question_number_on_page"] @plain_label = hsh["plain_label"] + @error_label = hsh["error_label"] @disable_clearing_if_not_routed_or_dynamic_answer_options = hsh["disable_clearing_if_not_routed_or_dynamic_answer_options"] end end @@ -195,7 +197,7 @@ class Form::Question end def display_label - check_answer_label || header || id.humanize + error_label || check_answer_label || header || id.humanize end def unanswered_error_message @@ -241,8 +243,8 @@ class Form::Question selected_answer_option_is_derived?(log) || has_inferred_check_answers_value?(log) end - def question_number_string(conditional: false) - if @question_number && !conditional && form.start_date.year >= 2023 + def question_number_string(hidden: false) + if @question_number && !hidden && form.start_date.year >= 2023 "Q#{@question_number}" end end diff --git a/app/models/form/sales/questions/address_line1.rb b/app/models/form/sales/questions/address_line1.rb index 73803d5bb..5573d9e10 100644 --- a/app/models/form/sales/questions/address_line1.rb +++ b/app/models/form/sales/questions/address_line1.rb @@ -4,10 +4,13 @@ class Form::Sales::Questions::AddressLine1 < ::Form::Question @id = "address_line1" @check_answer_label = "Address" @header = "Address line 1" + @error_label = "Address line 1" @type = "text" @plain_label = true - @check_answer_label = "Q15 - Address lines 1 and 2" + @check_answer_label = "Address lines 1 and 2" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 15 + @hide_question_number_on_page = true end def answer_label(log, _current_user = nil) diff --git a/app/models/form/sales/questions/county.rb b/app/models/form/sales/questions/county.rb index 8989fea72..9bd68d350 100644 --- a/app/models/form/sales/questions/county.rb +++ b/app/models/form/sales/questions/county.rb @@ -5,7 +5,9 @@ class Form::Sales::Questions::County < ::Form::Question @header = "County (optional)" @type = "text" @plain_label = true - @check_answer_label = "Q15 - County" + @check_answer_label = "County" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 15 + @hide_question_number_on_page = true end end diff --git a/app/models/form/sales/questions/postcode_for_full_address.rb b/app/models/form/sales/questions/postcode_for_full_address.rb index 0f43d73f2..f4a21d0e3 100644 --- a/app/models/form/sales/questions/postcode_for_full_address.rb +++ b/app/models/form/sales/questions/postcode_for_full_address.rb @@ -17,7 +17,9 @@ class Form::Sales::Questions::PostcodeForFullAddress < ::Form::Question }, } @plain_label = true - @check_answer_label = "Q15 - Postcode" + @check_answer_label = "Postcode" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 15 + @hide_question_number_on_page = true end end diff --git a/app/models/form/sales/questions/town_or_city.rb b/app/models/form/sales/questions/town_or_city.rb index 073a85dc3..4c23c0671 100644 --- a/app/models/form/sales/questions/town_or_city.rb +++ b/app/models/form/sales/questions/town_or_city.rb @@ -5,7 +5,9 @@ class Form::Sales::Questions::TownOrCity < ::Form::Question @header = "Town or city" @type = "text" @plain_label = true - @check_answer_label = "Q15 - Town or city" + @check_answer_label = "Town or city" @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @question_number = 12 + @hide_question_number_on_page = true end end