Browse Source

Extract student not a child confirmation questions and page copy to translation files

pull/2707/head
Kat 2 years ago
parent
commit
a2064977d7
  1. 3
      app/models/form/sales/pages/person_student_not_child_value_check.rb
  2. 3
      app/models/form/sales/questions/person_student_not_child_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. 5
      spec/models/form/sales/pages/person_student_not_child_value_check_spec.rb

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

@ -6,9 +6,10 @@ class Form::Sales::Pages::PersonStudentNotChildValueCheck < Form::Sales::Pages::
"person_#{person_index}_student_not_child?" => true, "person_#{person_index}_student_not_child?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.student_not_child_value_check"
@person_index = person_index @person_index = person_index
@title_text = { @title_text = {
"translation" => "soft_validations.student_not_child.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
} }
@informative_text = {} @informative_text = {}
end end

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

@ -2,7 +2,7 @@ class Form::Sales::Questions::PersonStudentNotChildValueCheck < ::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 = "student_not_child_value_check" @id = "student_not_child_value_check"
@check_answer_label = "Student not a child confirmation" @copy_key = "sales.soft_validations.student_not_child_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::PersonStudentNotChildValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this person is not a child?"
end end
end end

2
config/locales/en.yml

@ -756,8 +756,6 @@ Make sure these answers are correct."
monthly_charges_over_soft_max: monthly_charges_over_soft_max:
title_text: "You told us that the monthly charges were %{mscharge}." title_text: "You told us that the monthly charges were %{mscharge}."
hint_text: "This is higher than we would expect." hint_text: "This is higher than we would expect."
student_not_child:
title_text: "You told us this person is a student aged between 16 and 19."
discounted_sale_value: discounted_sale_value:
title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}." title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}."
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}."

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

@ -56,3 +56,9 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
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."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."
student_not_child_value_check:
page_header: ""
check_answer_label: "Student not a child confirmation"
hint_text: ""
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."

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

@ -56,3 +56,9 @@ en:
question_text: "Are you sure this is correct?" question_text: "Are you sure this is correct?"
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."
informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property."
student_not_child_value_check:
page_header: ""
check_answer_label: "Student not a child confirmation"
hint_text: ""
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."

5
spec/models/form/sales/pages/person_student_not_child_value_check_spec.rb

@ -4,7 +4,8 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
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) { 2 } let(:person_index) { 2 }
let(:page_id) { "person_2_student_not_child_value_check" } let(:page_id) { "person_2_student_not_child_value_check" }
@ -23,7 +24,7 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
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.student_not_child.title_text", "translation" => "forms.2024.sales.soft_validations.student_not_child_value_check.title_text",
}) })
end end

Loading…
Cancel
Save