diff --git a/app/models/form/lettings/pages/lead_tenant_gender_same_as_sex.rb b/app/models/form/lettings/pages/lead_tenant_gender_same_as_sex.rb index dc506f708..a59a0d08f 100644 --- a/app/models/form/lettings/pages/lead_tenant_gender_same_as_sex.rb +++ b/app/models/form/lettings/pages/lead_tenant_gender_same_as_sex.rb @@ -8,6 +8,7 @@ class Form::Lettings::Pages::LeadTenantGenderSameAsSex < ::Form::Page def questions @questions ||= [ Form::Lettings::Questions::GenderSameAsSex.new(nil, nil, self, person_index: 1), + Form::Lettings::Questions::GenderDescription.new(nil, nil, self, person_index: 1), ] end end diff --git a/app/models/form/lettings/pages/person_gender_same_as_sex.rb b/app/models/form/lettings/pages/person_gender_same_as_sex.rb index 9151c471c..f0969c267 100644 --- a/app/models/form/lettings/pages/person_gender_same_as_sex.rb +++ b/app/models/form/lettings/pages/person_gender_same_as_sex.rb @@ -11,6 +11,7 @@ class Form::Lettings::Pages::PersonGenderSameAsSex < ::Form::Page def questions @questions ||= [ Form::Lettings::Questions::GenderSameAsSex.new(nil, nil, self, person_index: @person_index), + Form::Lettings::Questions::GenderDescription.new(nil, nil, self, person_index: @person_index), ] end end diff --git a/app/models/form/lettings/questions/gender_description.rb b/app/models/form/lettings/questions/gender_description.rb new file mode 100644 index 000000000..1de5fac9c --- /dev/null +++ b/app/models/form/lettings/questions/gender_description.rb @@ -0,0 +1,16 @@ +class Form::Lettings::Questions::GenderDescription < ::Form::Question + def initialize(id, hsh, page, person_index:) + super(id, hsh, page) + @id = "gender_description#{person_index}" + @type = "text" + @check_answers_card_number = person_index + @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @person_index = person_index + end + + def derived?(log) + log.public_send("gender_same_as_sex#{@person_index}") != 2 + end + + QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze +end diff --git a/app/models/form/lettings/questions/gender_same_as_sex.rb b/app/models/form/lettings/questions/gender_same_as_sex.rb index 746ddc1ab..bf5cb7e19 100644 --- a/app/models/form/lettings/questions/gender_same_as_sex.rb +++ b/app/models/form/lettings/questions/gender_same_as_sex.rb @@ -5,6 +5,7 @@ class Form::Lettings::Questions::GenderSameAsSex < ::Form::Question @type = "radio" @check_answers_card_number = person_index @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @conditional_for = { "gender_description#{person_index}" => [2] } @person_index = person_index end diff --git a/config/locales/forms/2026/lettings/household_characteristics.en.yml b/config/locales/forms/2026/lettings/household_characteristics.en.yml index a354d1661..d26f1603a 100644 --- a/config/locales/forms/2026/lettings/household_characteristics.en.yml +++ b/config/locales/forms/2026/lettings/household_characteristics.en.yml @@ -37,6 +37,13 @@ en: hint_text: "" question_text: "Is the gender the lead tenant identifies with the same as their sex registered at birth?" + gender_description1: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex1: page_header: "" check_answer_label: "Lead tenant’s gender identity" @@ -144,6 +151,13 @@ en: hint_text: "" question_text: "Is the gender person 2 identifies with the same as their sex registered at birth?" + gender_description2: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex2: page_header: "" check_answer_label: "Person 2’s gender identity" @@ -199,6 +213,13 @@ en: hint_text: "" question_text: "Is the gender person 3 identifies with the same as their sex registered at birth?" + gender_description3: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex3: page_header: "" check_answer_label: "Person 3’s gender identity" @@ -254,6 +275,13 @@ en: hint_text: "" question_text: "Is the gender person 4 identifies with the same as their sex registered at birth?" + gender_description4: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex4: page_header: "" check_answer_label: "Person 4’s gender identity" @@ -309,6 +337,13 @@ en: hint_text: "" question_text: "Is the gender person 5 identifies with the same as their sex registered at birth?" + gender_description5: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex5: page_header: "" check_answer_label: "Person 5’s gender identity" @@ -364,6 +399,13 @@ en: hint_text: "" question_text: "Is the gender person 6 identifies with the same as their sex registered at birth?" + gender_description6: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex6: page_header: "" check_answer_label: "Person 6’s gender identity" @@ -419,6 +461,13 @@ en: hint_text: "" question_text: "Is the gender person 7 identifies with the same as their sex registered at birth?" + gender_description7: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex7: page_header: "" check_answer_label: "Person 7’s gender identity" @@ -474,6 +523,13 @@ en: hint_text: "" question_text: "Is the gender person 8 identifies with the same as their sex registered at birth?" + gender_description8: + page_header: "" + check_answer_label: "Gender identity" + check_answer_prompt: "" + hint_text: "" + question_text: "Enter gender identity" + sex8: page_header: "" check_answer_label: "Person 8’s gender identity"