Browse Source

Extract partner under 16 value check page and question copy to translation files

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

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

@ -6,9 +6,10 @@ class Form::Sales::Pages::PartnerUnder16ValueCheck < Form::Sales::Pages::Person
"person_#{person_index}_partner_under_16?" => true, "person_#{person_index}_partner_under_16?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.partner_under_16_value_check"
@person_index = person_index @person_index = person_index
@title_text = { @title_text = {
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age#{person_index}", "key" => "age#{person_index}",

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

@ -2,7 +2,7 @@ class Form::Sales::Questions::PartnerUnder16ValueCheck < ::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 = "partner_under_16_value_check" @id = "partner_under_16_value_check"
@check_answer_label = "Partner under 16 confirmation" @copy_key = "sales.soft_validations.partner_under_16_value_check"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::PartnerUnder16ValueCheck < ::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

2
config/locales/en.yml

@ -811,8 +811,6 @@ Make sure these answers are correct."
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."
partner_under_16_sales:
title: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1."
multiple_partners_lettings: multiple_partners_lettings:
title: "You told us there are more than 1 persons with 'Partner' relationship to the lead tenant." title: "You told us there are more than 1 persons with 'Partner' relationship to the lead tenant."
multiple_partners_sales: multiple_partners_sales:

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

@ -62,3 +62,9 @@ en:
hint_text: "" hint_text: ""
question_text: "Are you sure this person is not a child?" question_text: "Are you sure this person is not a 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."
partner_under_16_value_check:
page_header: ""
check_answer_label: "Partner under 16 confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1."

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

@ -62,3 +62,9 @@ en:
hint_text: "" hint_text: ""
question_text: "Are you sure this person is not a child?" question_text: "Are you sure this person is not a 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."
partner_under_16_value_check:
page_header: ""
check_answer_label: "Partner under 16 confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us this person is aged %{age} years and has 'Partner' relationship to buyer 1."

15
spec/models/form/sales/pages/partner_under16_value_check_spec.rb

@ -4,7 +4,8 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) } subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) }
let(:page_definition) { nil } let(:page_definition) { nil }
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:) }
let(:person_index) { 1 } let(:person_index) { 1 }
let(:page_id) { "partner_under_16_value_check" } let(:page_id) { "partner_under_16_value_check" }
@ -39,7 +40,7 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.2024.sales.soft_validations.partner_under_16_value_check.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age1", "key" => "age1",
@ -77,7 +78,7 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.2024.sales.soft_validations.partner_under_16_value_check.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age2", "key" => "age2",
@ -115,7 +116,7 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.2024.sales.soft_validations.partner_under_16_value_check.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age3", "key" => "age3",
@ -153,7 +154,7 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.2024.sales.soft_validations.partner_under_16_value_check.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age4", "key" => "age4",
@ -191,7 +192,7 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.2024.sales.soft_validations.partner_under_16_value_check.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age5", "key" => "age5",
@ -229,7 +230,7 @@ RSpec.describe Form::Sales::Pages::PartnerUnder16ValueCheck, type: :model do
it "has correct title_text" do it "has correct title_text" do
expect(page.title_text).to eq({ expect(page.title_text).to eq({
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.2024.sales.soft_validations.partner_under_16_value_check.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age6", "key" => "age6",

Loading…
Cancel
Save