Browse Source

Extract buyer live-in value check page and question copy to translation files

pull/2707/head
Kat 2 years ago
parent
commit
6fe5d6d970
  1. 5
      app/models/form/sales/pages/buyer_live_in_value_check.rb
  2. 3
      app/models/form/sales/questions/buyer_live_in_value_check.rb
  3. 6
      config/locales/en.yml
  4. 15
      config/locales/forms/2023/sales/soft_validations.en.yml
  5. 15
      config/locales/forms/2024/sales/soft_validations.en.yml
  6. 7
      spec/models/form/sales/pages/buyer_live_in_value_check_spec.rb

5
app/models/form/sales/pages/buyer_live_in_value_check.rb

@ -6,12 +6,13 @@ class Form::Sales::Pages::BuyerLiveInValueCheck < Form::Sales::Pages::Person
"buyer#{person_index}_livein_wrong_for_ownership_type?" => true, "buyer#{person_index}_livein_wrong_for_ownership_type?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.buyer_livein_value_check.buyer#{person_index}"
@title_text = { @title_text = {
"translation" => "soft_validations.buyer#{person_index}_livein_wrong_for_ownership_type.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }], "arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.buyer#{person_index}_livein_wrong_for_ownership_type.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }], "arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
} }
end end

3
app/models/form/sales/questions/buyer_live_in_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::BuyerLiveInValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "buyer_livein_value_check" @id = "buyer_livein_value_check"
@check_answer_label = "Buyer live in confirmation" @copy_key = "sales.soft_validations.buyer_livein_value_check.buyer#{person_index}"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::BuyerLiveInValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this is correct?"
end end
end end

6
config/locales/en.yml

@ -763,12 +763,6 @@ Make sure these answers are correct."
informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}." informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}."
care_home_charges: care_home_charges:
title_text: "Care home charges should be provided if this is a care home accommodation." title_text: "Care home charges should be provided if this is a care home accommodation."
buyer1_livein_wrong_for_ownership_type:
title_text: "You told us that buyer 1 will not live in the property."
hint_text: " For %{ownership_scheme} types, the buyer usually lives in the property."
buyer2_livein_wrong_for_ownership_type:
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."
percentage_discount_value: percentage_discount_value:
title_text: "You told us that the percentage discount is %{discount}." title_text: "You told us that the percentage discount is %{discount}."
hint_text: "This is higher than we would expect." hint_text: "This is higher than we would expect."

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

@ -41,3 +41,18 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us income was %{income}." title_text: "You told us income was %{income}."
informative_text: "This is less than we would expect for someone in this working situation." informative_text: "This is less than we would expect for someone in this working situation."
buyer_livein_value_check:
buyer1:
page_header: ""
check_answer_label: "Buyer live in confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that buyer 1 will not live in the property."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."
buyer2:
page_header: ""
check_answer_label: "Buyer live in confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that buyer 2 will not live in the property."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."

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

@ -41,3 +41,18 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
title_text: "You told us income was %{income}." title_text: "You told us income was %{income}."
informative_text: "This is less than we would expect for someone in this working situation." informative_text: "This is less than we would expect for someone in this working situation."
buyer_livein_value_check:
buyer1:
page_header: ""
check_answer_label: "Buyer live in confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that buyer 1 will not live in the property."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."
buyer2:
page_header: ""
check_answer_label: "Buyer live in confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that buyer 2 will not live in the property."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."

7
spec/models/form/sales/pages/buyer_live_in_value_check_spec.rb

@ -6,7 +6,8 @@ RSpec.describe Form::Sales::Pages::BuyerLiveInValueCheck, type: :model do
let(:page_id) { "buyer_1_live_in_value_check" } let(:page_id) { "buyer_1_live_in_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:person_index) { 1 } let(:person_index) { 1 }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -34,7 +35,7 @@ RSpec.describe Form::Sales::Pages::BuyerLiveInValueCheck, type: :model do
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.buyer1_livein_wrong_for_ownership_type.title_text", "translation" => "forms.2024.sales.soft_validations.buyer_livein_value_check.buyer1.title_text",
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }], "arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
}) })
end end
@ -56,7 +57,7 @@ RSpec.describe Form::Sales::Pages::BuyerLiveInValueCheck, type: :model do
it "has the correct title_text" do it "has the correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.buyer2_livein_wrong_for_ownership_type.title_text", "translation" => "forms.2024.sales.soft_validations.buyer_livein_value_check.buyer2.title_text",
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }], "arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
}) })
end end

Loading…
Cancel
Save