Browse Source

Enable adding question numbers to page headers

CLDC-3787-Autocomplete-address-search
Manny Dinssa 1 week ago
parent
commit
8d9891e50b
  1. 3
      app/models/form/lettings/pages/address_fallback.rb
  2. 3
      app/models/form/page.rb
  3. 3
      app/models/form/sales/pages/address_fallback.rb
  4. 2
      app/views/form/page.html.erb
  5. 2
      config/locales/forms/2024/lettings/property_information.en.yml
  6. 2
      config/locales/forms/2024/sales/property_information.en.yml
  7. 2
      config/locales/forms/2025/lettings/property_information.en.yml
  8. 2
      config/locales/forms/2025/sales/property_information.en.yml

3
app/models/form/lettings/pages/address_fallback.rb

@ -11,6 +11,7 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => false },
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => false },
]
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
def questions
@ -22,4 +23,6 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page
Form::Lettings::Questions::PostcodeForFullAddress.new(nil, nil, self),
]
end
QUESTION_NUMBER_FROM_YEAR = { 2024 => 13, 2025 => 13 }.freeze
end

3
app/models/form/page.rb

@ -1,7 +1,7 @@
class Form::Page
attr_accessor :id, :header_partial, :description, :questions, :depends_on, :title_text,
:informative_text, :subsection, :hide_subsection_label, :next_unresolved_page_id,
:skip_text, :interruption_screen_question_ids, :submit_text
:skip_text, :interruption_screen_question_ids, :submit_text, :question_number
def initialize(id, hsh, subsection)
@id = id
@ -11,6 +11,7 @@ class Form::Page
@header_partial = hsh["header_partial"]
@description = hsh["description"]
@questions = hsh["questions"].map { |q_id, q| Form::Question.new(q_id, q, self) }
@question_number = hsh["question_number"]
@depends_on = hsh["depends_on"]
@title_text = hsh["title_text"]
@informative_text = hsh["informative_text"]

3
app/models/form/sales/pages/address_fallback.rb

@ -11,6 +11,7 @@ class Form::Sales::Pages::AddressFallback < ::Form::Page
{ "uprn_known" => 0, "address_options_present?" => false },
{ "uprn_confirmed" => 0, "address_options_present?" => false },
]
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
def questions
@ -22,4 +23,6 @@ class Form::Sales::Pages::AddressFallback < ::Form::Page
Form::Sales::Questions::PostcodeForFullAddress.new(nil, nil, self),
]
end
QUESTION_NUMBER_FROM_YEAR = { 2024 => 16, 2025 => 16 }.freeze
end

2
app/views/form/page.html.erb

@ -27,7 +27,7 @@
<% if @page.header_partial.present? %>
<%= render partial: "form/headers/#{@page.header_partial}", locals: { log: @log } %>
<% else %>
<%= @page.header %>
<%= @page.question_number ? "Q#{@page.question_number} - #{@page.header}" : @page.header %>
<% end %>
</h1>
<% end %>

2
config/locales/forms/2024/lettings/property_information.en.yml

@ -58,7 +58,7 @@ en:
question_text: "Search by address or UPRN"
address:
page_header: "Q12 - What is the property's address?"
page_header: "What is the property's address?"
address_line1:
check_answer_label: "Address lines 1 and 2"
check_answer_prompt: "Enter address lines 1 and 2"

2
config/locales/forms/2024/sales/property_information.en.yml

@ -51,7 +51,7 @@ en:
question_text: "Search by address or UPRN"
address:
page_header: "Q12 - What is the property's address?"
page_header: "What is the property's address?"
address_line1:
check_answer_label: "Address lines 1 and 2"
check_answer_prompt: "Enter address lines 1 and 2"

2
config/locales/forms/2025/lettings/property_information.en.yml

@ -58,7 +58,7 @@ en:
question_text: "Search by address or UPRN"
address:
page_header: "Q12 - What is the property's address?"
page_header: "What is the property's address?"
address_line1:
check_answer_label: "Address lines 1 and 2"
check_answer_prompt: "Enter address lines 1 and 2"

2
config/locales/forms/2025/sales/property_information.en.yml

@ -51,7 +51,7 @@ en:
question_text: "Search by address or UPRN"
address:
page_header: "Q12 - What is the property's address?"
page_header: "What is the property's address?"
address_line1:
check_answer_label: "Address lines 1 and 2"
check_answer_prompt: "Enter address lines 1 and 2"

Loading…
Cancel
Save