Browse Source

Extract some uprn copy

pull/2726/head
Manny Dinssa 8 months ago
parent
commit
80f15e489e
  1. 2
      app/models/form/lettings/pages/address.rb
  2. 2
      app/models/form/lettings/pages/address_fallback.rb
  3. 2
      app/models/form/lettings/pages/address_matcher.rb
  4. 14
      app/models/form/lettings/pages/property_postcode.rb
  5. 1
      app/models/form/lettings/pages/uprn_selection.rb
  6. 3
      app/models/form/lettings/questions/address_line1.rb
  7. 2
      app/models/form/lettings/questions/address_line1_for_address_matcher.rb
  8. 2
      app/models/form/lettings/questions/address_line2.rb
  9. 3
      app/models/form/lettings/questions/county.rb
  10. 2
      app/models/form/lettings/questions/postcode_for_address_matcher.rb
  11. 3
      app/models/form/lettings/questions/postcode_for_full_address.rb
  12. 15
      app/models/form/lettings/questions/postcode_full.rb
  13. 17
      app/models/form/lettings/questions/postcode_known.rb
  14. 3
      app/models/form/lettings/questions/town_or_city.rb
  15. 3
      app/models/form/lettings/questions/uprn.rb
  16. 6
      app/models/form/lettings/questions/uprn_known.rb
  17. 2
      app/models/form/lettings/questions/uprn_selection.rb
  18. 8
      app/models/form/lettings/subsections/property_information.rb
  19. 74
      config/locales/forms/2023/lettings/property_information.en.yml
  20. 92
      config/locales/forms/2024/lettings/property_information.en.yml

2
app/models/form/lettings/pages/address.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::Address < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "address"
@header = "Q#{QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]} - What is the property's address?"
@copy_key = "lettings.property_information.address"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil },
{ "is_supported_housing?" => false, "uprn_known" => 0 },

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

@ -2,7 +2,7 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "address"
@header = "Q12 - What is the property's address?"
@copy_key = "lettings.property_information.address"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "uprn_selection" => "uprn_not_listed" },
{ "is_supported_housing?" => false, "uprn_known" => 0, "uprn_selection" => "uprn_not_listed" },

2
app/models/form/lettings/pages/address_matcher.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::AddressMatcher < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "address_matcher"
@header = "Find an address"
@copy_key = "lettings.property_information.address_matcher"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil },
{ "is_supported_housing?" => false, "uprn_known" => 0 },

14
app/models/form/lettings/pages/property_postcode.rb

@ -1,14 +0,0 @@
class Form::Lettings::Pages::PropertyPostcode < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "property_postcode"
@depends_on = [{ "is_general_needs?" => true }]
end
def questions
@questions ||= [
Form::Lettings::Questions::PostcodeKnown.new(nil, nil, self),
Form::Lettings::Questions::PostcodeFull.new(nil, nil, self),
]
end
end

1
app/models/form/lettings/pages/uprn_selection.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::UprnSelection < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "uprn_selection"
@header = "We found some addresses that might be this property"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => true },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => true },

3
app/models/form/lettings/questions/address_line1.rb

@ -2,11 +2,10 @@ class Form::Lettings::Questions::AddressLine1 < ::Form::Question
def initialize(id, hsh, page)
super
@id = "address_line1"
@header = "Address line 1"
@copy_key = "lettings.property_information.address.address_line1"
@error_label = "Address line 1"
@type = "text"
@plain_label = true
@check_answer_label = "Address lines 1 and 2"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hide_question_number_on_page = true

2
app/models/form/lettings/questions/address_line1_for_address_matcher.rb

@ -2,7 +2,7 @@ class Form::Lettings::Questions::AddressLine1ForAddressMatcher < ::Form::Questio
def initialize(id, hsh, page)
super
@id = "address_line1_input"
@header = "Address line 1"
@copy_key = "lettings.property_information.address.address_line1"
@error_label = "Address line 1"
@type = "text"
@plain_label = true

2
app/models/form/lettings/questions/address_line2.rb

@ -2,7 +2,7 @@ class Form::Lettings::Questions::AddressLine2 < ::Form::Question
def initialize(id, hsh, page)
super
@id = "address_line2"
@header = "Address line 2 (optional)"
@copy_key = "lettings.property_information.address.address_line2"
@type = "text"
@plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true

3
app/models/form/lettings/questions/county.rb

@ -2,10 +2,9 @@ class Form::Lettings::Questions::County < ::Form::Question
def initialize(id, hsh, page)
super
@id = "county"
@header = "County (optional)"
@copy_key = "lettings.property_information.address.county"
@type = "text"
@plain_label = true
@check_answer_label = "County"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hide_question_number_on_page = true

2
app/models/form/lettings/questions/postcode_for_address_matcher.rb

@ -2,7 +2,7 @@ class Form::Lettings::Questions::PostcodeForAddressMatcher < ::Form::Question
def initialize(id, hsh, page)
super
@id = "postcode_full_input"
@header = "Postcode"
@copy_key = "lettings.property_information.address.postcode_full_input"
@type = "text"
@width = 5
@plain_label = true

3
app/models/form/lettings/questions/postcode_for_full_address.rb

@ -2,7 +2,7 @@ class Form::Lettings::Questions::PostcodeForFullAddress < ::Form::Question
def initialize(id, hsh, page)
super
@id = "postcode_full"
@header = "Postcode"
@copy_key = "lettings.property_information.address.postcode_full"
@type = "text"
@width = 5
@inferred_check_answers_value = [{
@ -17,7 +17,6 @@ class Form::Lettings::Questions::PostcodeForFullAddress < ::Form::Question
},
}
@plain_label = true
@check_answer_label = "Postcode"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hide_question_number_on_page = true

15
app/models/form/lettings/questions/postcode_full.rb

@ -1,15 +0,0 @@
class Form::Lettings::Questions::PostcodeFull < ::Form::Question
def initialize(id, hsh, page)
super
@id = "postcode_full"
@check_answer_label = "Postcode"
@header = "What is the property’s postcode?"
@type = "text"
@width = 5
@inferred_check_answers_value = [{ "condition" => { "postcode_known" => 0 }, "value" => "Not known" }]
@check_answers_card_number = 0
@hint_text = ""
@inferred_answers = { "la" => { "is_la_inferred" => true } }
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end
end

17
app/models/form/lettings/questions/postcode_known.rb

@ -1,17 +0,0 @@
class Form::Lettings::Questions::PostcodeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "postcode_known"
@check_answer_label = "Do you know the property postcode?"
@header = "Do you know the property’s postcode?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@conditional_for = { "postcode_full" => [1] }
@hidden_in_check_answers = { "depends_on" => [{ "postcode_known" => 0 }, { "postcode_known" => 1 }] }
end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze
end

3
app/models/form/lettings/questions/town_or_city.rb

@ -2,10 +2,9 @@ class Form::Lettings::Questions::TownOrCity < ::Form::Question
def initialize(id, hsh, page)
super
@id = "town_or_city"
@header = "Town or city"
@copy_key = "lettings.property_information.address.town_or_city"
@type = "text"
@plain_label = true
@check_answer_label = "Town or city"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hide_question_number_on_page = true

3
app/models/form/lettings/questions/uprn.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::Uprn < ::Form::Question
def initialize(id, hsh, page)
super
@id = "uprn"
@check_answer_label = "UPRN"
@header = "What is the property's UPRN?"
@copy_key = "lettings.property_information.uprn.uprn"
@type = "text"
@width = 10
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

6
app/models/form/lettings/questions/uprn_known.rb

@ -2,13 +2,9 @@ class Form::Lettings::Questions::UprnKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "uprn_known"
@check_answer_label = "UPRN known?"
@header = "Do you know the property's UPRN?"
@copy_key = "lettings.property_information.uprn.uprn_known"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.<br><br>
The UPRN may not be the same as the property reference assigned by your organisation.<br><br>
If you dont know the UPRN you can enter the address of the property instead on the next screen."
@conditional_for = { "uprn" => [1] }
@inferred_check_answers_value = [
{

2
app/models/form/lettings/questions/uprn_selection.rb

@ -2,9 +2,7 @@ class Form::Lettings::Questions::UprnSelection < ::Form::Question
def initialize(id, hsh, page)
super
@id = "uprn_selection"
@header = "Select the correct address"
@type = "radio"
@check_answer_label = "Select the correct address"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end

8
app/models/form/lettings/subsections/property_information.rb

@ -36,20 +36,16 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
Form::Lettings::Pages::Uprn.new(nil, nil, self),
Form::Lettings::Pages::UprnConfirmation.new(nil, nil, self),
Form::Lettings::Pages::AddressMatcher.new(nil, nil, self),
Form::Lettings::Pages::NoAddressFound.new(nil, nil, self),
Form::Lettings::Pages::NoAddressFound.new(nil, nil, self), # soft validation
Form::Lettings::Pages::UprnSelection.new(nil, nil, self),
Form::Lettings::Pages::AddressFallback.new(nil, nil, self),
]
elsif form.start_date.year == 2023
else
[
Form::Lettings::Pages::Uprn.new(nil, nil, self),
Form::Lettings::Pages::UprnConfirmation.new(nil, nil, self),
Form::Lettings::Pages::Address.new(nil, nil, self),
]
else
[
Form::Lettings::Pages::PropertyPostcode.new(nil, nil, self),
]
end
end

74
config/locales/forms/2023/lettings/property_information.en.yml

@ -0,0 +1,74 @@
en:
forms:
2023:
lettings:
property_information:
uprn:
page_header: ""
uprn_known:
check_answer_label: "UPRN known?"
hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.<br><br>The UPRN may not be the same as the property reference assigned by your organisation.<br><br>If you don’t know the UPRN you can enter the address of the property instead on the next screen."
question_text: "Do you know the property's UPRN?"
uprn:
check_answer_label: "UPRN"
hint_text: ""
question_text: "What is the property's UPRN?"
uprn_confirmed:
page_header: "We found an address that might be this property"
check_answer_label: "Is this the right address?"
hint_text: ""
question_text: "Is this the property address?"
address:
page_header: "Q12 - What is the property's address?"
address_line1:
check_answer_label: "Address lines 1 and 2"
hint_text: ""
question_text: "Address line 1"
address_line2:
check_answer_label: ""
hint_text: ""
question_text: "Address line 2 (optional)"
town_or_city:
check_answer_label: "Town or city"
hint_text: ""
question_text: "Town or city"
county:
check_answer_label: "County"
hint_text: ""
question_text: "County (optional)"
postcode_full:
check_answer_label: "Postcode"
hint_text: ""
question_text: "Postcode"
la:
page_header: ""
check_answer_label: "Local authority"
hint_text: ""
question_text: "What is the property’s local authority?"
beds:
page_header: ""
check_answer_label: "Number of bedrooms"
hint_text: "A bedsit has 1 bedroom."
question_text: "How many bedrooms does the property have?"
proptype:
page_header: ""
check_answer_label: "Type of unit"
hint_text: ""
question_text: "What type of unit is the property?"
builtype:
page_header: ""
check_answer_label: "Type of building"
hint_text: ""
question_text: "What type of building is the property?"
wchair:
page_header: ""
check_answer_label: "Property built or adapted to wheelchair-user standards"
hint_text: ""
question_text: "Is the property built or adapted to wheelchair-user standards?"

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

@ -0,0 +1,92 @@
en:
forms:
2024:
lettings:
property_information:
uprn:
page_header: ""
uprn_known:
check_answer_label: "UPRN known?"
hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.<br><br>The UPRN may not be the same as the property reference assigned by your organisation.<br><br>If you don’t know the UPRN you can enter the address of the property instead on the next screen."
question_text: "Do you know the property's UPRN?"
uprn:
check_answer_label: "UPRN"
hint_text: ""
question_text: "What is the property's UPRN?"
uprn_confirmed:
page_header: "We found an address that might be this property"
check_answer_label: "Is this the right address?"
hint_text: ""
question_text: "Is this the property address?"
address_matcher:
page_header: "Find an address"
address_line1_input:
check_answer_label: "Find address"
hint_text: ""
question_text: "Address line 1"
postcode_full_input:
check_answer_label: ""
hint_text: ""
question_text: "Postcode"
uprn_selection:
page_header: "We found an address that might be this property"
check_answer_label: "Select the correct address"
hint_text: ""
question_text: "Select the correct address"
address:
page_header: "Q12 - What is the property's address?"
address_line1:
check_answer_label: "Address lines 1 and 2"
hint_text: ""
question_text: "Address line 1"
address_line2:
check_answer_label: ""
hint_text: ""
question_text: "Address line 2 (optional)"
town_or_city:
check_answer_label: "Town or city"
hint_text: ""
question_text: "Town or city"
county:
check_answer_label: "County"
hint_text: ""
question_text: "County (optional)"
postcode_full:
check_answer_label: "Postcode"
hint_text: ""
question_text: "Postcode"
la:
page_header: ""
check_answer_label: "Local authority"
hint_text: ""
question_text: "What is the property’s local authority?"
beds:
page_header: ""
check_answer_label: "Number of bedrooms"
hint_text: "A bedsit has 1 bedroom."
question_text: "How many bedrooms does the property have?"
proptype:
page_header: ""
check_answer_label: "Type of unit"
hint_text: ""
question_text: "What type of unit is the property?"
builtype:
page_header: ""
check_answer_label: "Type of building"
hint_text: ""
question_text: "What type of building is the property?"
wchair:
page_header: ""
check_answer_label: "Property built or adapted to wheelchair-user standards"
hint_text: ""
question_text: "Is the property built or adapted to wheelchair-user standards?"
Loading…
Cancel
Save