Browse Source

Extract title text and informative text for soft validations

pull/2694/head
Manny Dinssa 8 months ago
parent
commit
755b4b9228
  1. 4
      app/models/form/sales/pages/about_price_value_check.rb
  2. 2
      app/models/form/sales/pages/buyer1_income_max_value_check.rb
  3. 2
      app/models/form/sales/pages/buyer2_income_max_value_check.rb
  4. 2
      app/models/form/sales/pages/combined_income_max_value_check.rb
  5. 4
      app/models/form/sales/pages/monthly_charges_value_check.rb
  6. 4
      app/models/form/sales/pages/no_address_found.rb
  7. 4
      app/models/form/sales/pages/percentage_discount_value_check.rb
  8. 16
      config/locales/en.yml
  9. 12
      config/locales/forms/2023/sales/soft_validations.en.yml
  10. 6
      config/locales/forms/2024/sales/property_information.en.yml
  11. 20
      config/locales/forms/2024/sales/soft_validations.en.yml
  12. 21
      spec/models/form/sales/pages/about_price_value_check_spec.rb

4
app/models/form/sales/pages/about_price_value_check.rb

@ -7,7 +7,7 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.purchase_price.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "value", "key" => "value",
@ -17,7 +17,7 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page
], ],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.purchase_price.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",

2
app/models/form/sales/pages/buyer1_income_max_value_check.rb

@ -7,7 +7,7 @@ class Form::Sales::Pages::Buyer1IncomeMaxValueCheck < ::Form::Page
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.income.over_soft_max_for_la_buyer_1", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",

2
app/models/form/sales/pages/buyer2_income_max_value_check.rb

@ -7,7 +7,7 @@ class Form::Sales::Pages::Buyer2IncomeMaxValueCheck < ::Form::Page
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.income.over_soft_max_for_la_buyer_2", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",

2
app/models/form/sales/pages/combined_income_max_value_check.rb

@ -7,7 +7,7 @@ class Form::Sales::Pages::CombinedIncomeMaxValueCheck < ::Form::Page
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.income.over_soft_max_for_la_combined", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",

4
app/models/form/sales/pages/monthly_charges_value_check.rb

@ -7,7 +7,7 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.monthly_charges_over_soft_max.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",
@ -17,7 +17,7 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page
], ],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.monthly_charges_over_soft_max.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

4
app/models/form/sales/pages/no_address_found.rb

@ -4,11 +4,11 @@ class Form::Sales::Pages::NoAddressFound < ::Form::Page
@id = "no_address_found" @id = "no_address_found"
@type = "interruption_screen" @type = "interruption_screen"
@title_text = { @title_text = {
"translation" => "soft_validations.no_address_found.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.no_address_found.informative_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
@depends_on = [ @depends_on = [

4
app/models/form/sales/pages/percentage_discount_value_check.rb

@ -2,11 +2,11 @@ class Form::Sales::Pages::PercentageDiscountValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@title_text = { @title_text = {
"translation" => "soft_validations.percentage_discount_value.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "discount", "label" => true, "i18n_template" => "discount" }], "arguments" => [{ "key" => "discount", "label" => true, "i18n_template" => "discount" }],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.percentage_discount_value.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.hint_text",
"arguments" => [], "arguments" => [],
} }
@depends_on = [{ "percentage_discount_invalid?" => true }] @depends_on = [{ "percentage_discount_invalid?" => true }]

16
config/locales/en.yml

@ -231,7 +231,7 @@ en:
scheme_deleted: "%{service_name} has been deleted." scheme_deleted: "%{service_name} has been deleted."
user_deleted: "%{name} has been deleted." user_deleted: "%{name} has been deleted."
organisation_deleted: "%{name} has been deleted." organisation_deleted: "%{name} has been deleted."
user_updated: user_updated:
self: "Your account details have been updated." self: "Your account details have been updated."
other: "%{name}’s details have been updated." other: "%{name}’s details have been updated."
@ -716,16 +716,10 @@ en:
under_soft_min_for_economic_status: under_soft_min_for_economic_status:
title_text: "You told us income was %{income}." title_text: "You told us income was %{income}."
hint_text: "This is less than we would expect for someone in this working situation." hint_text: "This is less than we would expect for someone in this working situation."
over_soft_max_for_la_buyer_1: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?"
over_soft_max_for_la_buyer_2: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?"
over_soft_max_for_la_combined: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
rent: rent:
outside_range_title: "You told us the rent is %{brent}." outside_range_title: "You told us the rent is %{brent}."
informative_text: "This is %{higher_or_lower} than we would expect." informative_text: "This is %{higher_or_lower} than we would expect."
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>" hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>"
purchase_price:
title_text: "You told us the purchase price is %{value}."
hint_text: "This is %{higher_or_lower} than we would expect."
staircase_owned: staircase_owned:
title_text: title_text:
one: "You told us that the buyer now owns %{stairowned} of the property." one: "You told us that the buyer now owns %{stairowned} of the property."
@ -762,9 +756,6 @@ Make sure these answers are correct."
staircase_bought_seems_high: staircase_bought_seems_high:
title_text: "You told us that %{percentage}% was bought in this staircasing transaction." title_text: "You told us that %{percentage}% was bought in this staircasing transaction."
hint_text: "Most staircasing transactions are less than 50%" hint_text: "Most staircasing transactions are less than 50%"
monthly_charges_over_soft_max:
title_text: "You told us that the monthly charges were %{mscharge}."
hint_text: "This is higher than we would expect."
student_not_child: student_not_child:
title_text: "You told us this person is a student aged between 16 and 19." title_text: "You told us this person is a student aged between 16 and 19."
discounted_sale_value: discounted_sale_value:
@ -778,9 +769,6 @@ Make sure these answers are correct."
buyer2_livein_wrong_for_ownership_type: buyer2_livein_wrong_for_ownership_type:
title_text: "You told us that buyer 2 will not live in the property." title_text: "You told us that buyer 2 will not live in the property."
hint_text: " For %{ownership_scheme} types, the buyer usually lives in the property." hint_text: " For %{ownership_scheme} types, the buyer usually lives in the property."
percentage_discount_value:
title_text: "You told us that the percentage discount is %{discount}."
hint_text: "This is higher than we would expect."
savings: savings:
title_text: title_text:
one: "You told us the buyer’s savings were %{savings}." one: "You told us the buyer’s savings were %{savings}."
@ -823,8 +811,6 @@ Make sure these answers are correct."
must_be_less_than_3_years_from_saledate: "You told us practical completion or handover date is more than 3 years before sale completion date." must_be_less_than_3_years_from_saledate: "You told us practical completion or handover date is more than 3 years before sale completion date."
saledate: saledate:
must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date." must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date."
no_address_found:
title_text: "No address found."
informative_text: "We could not find an address that matches your search. You can search again or continue to enter the address manually." informative_text: "We could not find an address that matches your search. You can search again or continue to enter the address manually."
partner_under_16_lettings: partner_under_16_lettings:
title: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant." title: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant."

12
config/locales/forms/2023/sales/soft_validations.en.yml

@ -8,33 +8,45 @@ en:
check_answer_label: "Buyer 1 income confirmation" check_answer_label: "Buyer 1 income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?"
informative_text: ""
income2_value_check: income2_value_check:
page_header: "" page_header: ""
check_answer_label: "Buyer 2 income confirmation" check_answer_label: "Buyer 2 income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?"
informative_text: ""
combined_income_value_check: combined_income_value_check:
page_header: "" page_header: ""
check_answer_label: "Combined income confirmation" check_answer_label: "Combined income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
informative_text: ""
value_value_check: value_value_check:
page_header: "" page_header: ""
check_answer_label: "Purchase price confirmation" check_answer_label: "Purchase price confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure?" question_text: "Are you sure?"
title_text: "You told us the purchase price is %{value}."
informative_text: "This is %{higher_or_lower} than we would expect."
monthly_charges_value_check: monthly_charges_value_check:
page_header: "" page_header: ""
check_answer_label: "Monthly charges confirmation" check_answer_label: "Monthly charges confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us that the monthly charges were %{mscharge}."
informative_text: "This is higher than we would expect."
percentage_discount_value_check: percentage_discount_value_check:
page_header: "" page_header: ""
check_answer_label: "Percentage discount confirmation" check_answer_label: "Percentage discount confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us that the percentage discount is %{discount}."
informative_text: "This is higher than we would expect."

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

@ -31,12 +31,6 @@ en:
hint_text: "" hint_text: ""
question_text: "Postcode" question_text: "Postcode"
address_search_value_check:
page_header: ""
check_answer_label: ""
hint_text: ""
question_text: "No address found"
uprn_selection: uprn_selection:
page_header: "We found an address that might be this property" page_header: "We found an address that might be this property"
check_answer_label: "Select the correct address" check_answer_label: "Select the correct address"

20
config/locales/forms/2024/sales/soft_validations.en.yml

@ -8,33 +8,53 @@ en:
check_answer_label: "Buyer 1 income confirmation" check_answer_label: "Buyer 1 income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?"
informative_text: ""
income2_value_check: income2_value_check:
page_header: "" page_header: ""
check_answer_label: "Buyer 2 income confirmation" check_answer_label: "Buyer 2 income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?"
informative_text: ""
combined_income_value_check: combined_income_value_check:
page_header: "" page_header: ""
check_answer_label: "Combined income confirmation" check_answer_label: "Combined income confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
informative_text: ""
value_value_check: value_value_check:
page_header: "" page_header: ""
check_answer_label: "Purchase price confirmation" check_answer_label: "Purchase price confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure?" question_text: "Are you sure?"
title_text: "You told us the purchase price is %{value}."
informative_text: "This is %{higher_or_lower} than we would expect."
monthly_charges_value_check: monthly_charges_value_check:
page_header: "" page_header: ""
check_answer_label: "Monthly charges confirmation" check_answer_label: "Monthly charges confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us that the monthly charges were %{mscharge}."
informative_text: "This is higher than we would expect."
percentage_discount_value_check: percentage_discount_value_check:
page_header: "" page_header: ""
check_answer_label: "Percentage discount confirmation" check_answer_label: "Percentage discount confirmation"
hint_text: "" hint_text: ""
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us that the percentage discount is %{discount}."
informative_text: "This is higher than we would expect."
address_search_value_check:
page_header: ""
check_answer_label: ""
hint_text: ""
question_text: ""
title_text: "No address found."
informative_text: "We could not find an address that matches your search. You can search again or continue to enter the address manually."

21
spec/models/form/sales/pages/about_price_value_check_spec.rb

@ -27,27 +27,6 @@ RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do
expect(page.interruption_screen?).to eq(true) expect(page.interruption_screen?).to eq(true)
end end
it "has the correct title_text" do
expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "value", "key" => "value", "label" => true }], "translation" => "soft_validations.purchase_price.title_text" })
end
it "has the correct informative_text" do
expect(page.informative_text).to eq({
"translation" => "soft_validations.purchase_price.hint_text",
"arguments" => [
{
"key" => "field_formatted_as_currency",
"arguments_for_key" => "purchase_price_soft_min_or_soft_max",
"i18n_template" => "soft_min_or_soft_max",
},
{
"key" => "purchase_price_higher_or_lower_text",
"i18n_template" => "higher_or_lower",
},
],
})
end
it "has the correct interruption_screen_question_ids" do it "has the correct interruption_screen_question_ids" do
expect(page.interruption_screen_question_ids).to eq(%w[value beds uprn postcode_full la]) expect(page.interruption_screen_question_ids).to eq(%w[value beds uprn postcode_full la])
end end

Loading…
Cancel
Save