Skip to content

Commit d4232d1

Browse files
authored
WRSAT-185 create disability benefits screen (#72)
1 parent 30f55af commit d4232d1

File tree

13 files changed

+196
-5
lines changed

13 files changed

+196
-5
lines changed

app/assets/stylesheets/application.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ i.no-button-cross {
6969
}
7070

7171
.checkbox-group {
72-
margin-bottom: 6rem;
73-
7472
.input-group {
7573
margin-bottom: 0;
7674
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class DisabilityBenefitsController < QuestionController
2+
include WrExemptionsConcern
3+
4+
def self.attributes_edited
5+
[
6+
:receiving_benefits_ssdi,
7+
:receiving_benefits_ssi,
8+
:receiving_benefits_veterans_disability,
9+
:receiving_benefits_disability_pension,
10+
:receiving_benefits_workers_compensation,
11+
:receiving_benefits_insurance_payments,
12+
:receiving_benefits_other,
13+
:receiving_benefits_none,
14+
:receiving_benefits_write_in
15+
]
16+
end
17+
end

app/controllers/navigation/screener_navigation.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ScreenerNavigation < ControllerNavigation::ControllerNavigation
1010
ControllerNavigation::NavigationStep.new(CaringForSomeoneController),
1111
ControllerNavigation::NavigationStep.new(IsPregnantController),
1212
ControllerNavigation::NavigationStep.new(HasUnemploymentBenefitsController),
13+
ControllerNavigation::NavigationStep.new(DisabilityBenefitsController),
1314
ControllerNavigation::NavigationStep.new(BasicInfoMilestoneController),
1415
ControllerNavigation::NavigationStep.new(PersonalInformationController),
1516
ControllerNavigation::NavigationStep.new(TempEndController)

app/models/screener.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ class Screener < ApplicationRecord
99
enum :caring_for_disabled_or_ill_person, {unfilled: 0, yes: 1, no: 2}, prefix: true
1010
enum :caring_for_no_one, {unfilled: 0, yes: 1, no: 2}, prefix: true
1111
enum :has_unemployment_benefits, {unfilled: 0, yes: 1, no: 2}, prefix: true
12+
enum :receiving_benefits_ssdi, {unfilled: 0, yes: 1, no: 2}, prefix: true
13+
enum :receiving_benefits_ssi, {unfilled: 0, yes: 1, no: 2}, prefix: true
14+
enum :receiving_benefits_veterans_disability, {unfilled: 0, yes: 1, no: 2}, prefix: true
15+
enum :receiving_benefits_disability_pension, {unfilled: 0, yes: 1, no: 2}, prefix: true
16+
enum :receiving_benefits_workers_compensation, {unfilled: 0, yes: 1, no: 2}, prefix: true
17+
enum :receiving_benefits_insurance_payments, {unfilled: 0, yes: 1, no: 2}, prefix: true
18+
enum :receiving_benefits_other, {unfilled: 0, yes: 1, no: 2}, prefix: true
19+
enum :receiving_benefits_none, {unfilled: 0, yes: 1, no: 2}, prefix: true
1220
attr_writer :birth_date_year, :birth_date_month, :birth_date_day
1321
attr_writer :pregnancy_due_date_year, :pregnancy_due_date_month, :pregnancy_due_date_day
1422
normalizes :phone_number, with: ->(value) { Phonelib.parse(value, "US").national }
@@ -48,6 +56,20 @@ class Screener < ApplicationRecord
4856
validates :has_unemployment_benefits, inclusion: {in: %w[yes no], message: I18n.t("validations.must_answer_yes_or_no")}
4957
end
5058

59+
with_context :disability_benefits do
60+
validates :receiving_benefits_none, inclusion: {in: %w[unfilled no]},
61+
if: -> {
62+
receiving_benefits_ssdi_yes? ||
63+
receiving_benefits_ssi_yes? ||
64+
receiving_benefits_veterans_disability_yes? ||
65+
receiving_benefits_disability_pension_yes? ||
66+
receiving_benefits_workers_compensation_yes? ||
67+
receiving_benefits_insurance_payments_yes? ||
68+
receiving_benefits_other_yes?
69+
}
70+
validates :receiving_benefits_write_in, absence: true, if: -> { receiving_benefits_other_no? }
71+
end
72+
5173
before_save do
5274
if is_pregnant_no?
5375
self.pregnancy_due_date = nil

app/views/caring_for_someone/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</div>
1717

1818
<%= form_with model: @model, url: { action: :update }, data: { turbo: false }, local: true, method: "put", builder: Cfa::Styleguide::CfaFormBuilder do |f| %>
19-
<div class="checkbox-group">
19+
<div class="checkbox-group spacing-below-60">
2020
<%= f.cfa_checkbox(:caring_for_child_under_6, t("views.caring_for_someone.edit.child_under_6"), options: { checked_value: "yes", unchecked_value: "no" }) %>
2121
<%= f.cfa_checkbox(:caring_for_disabled_or_ill_person, t("views.caring_for_someone.edit.disabled_or_ill_person"), options: { checked_value: "yes", unchecked_value: "no" }) %>
2222
<%= f.cfa_checkbox(:caring_for_no_one, t("general.none_of_the_above"), options: { checked_value: "yes", unchecked_value: "no", id: "none_of_the_above"}) %>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<% content_for :question_title, t("views.disability_benefits.edit.title") %>
2+
3+
<h1 class="h2"><%= content_for(:question_title) %></h1>
4+
5+
<%= form_with model: @model, url: { action: :update }, data: { turbo: false }, local: true, method: "put", builder: Cfa::Styleguide::CfaFormBuilder do |f| %>
6+
<%= f.hidden_field :receiving_benefits_write_in, value: "" %>
7+
<div class="checkbox-group">
8+
<div class="question-with-follow-up">
9+
<div class="question-with-follow-up__question">
10+
<%= f.cfa_checkbox(:receiving_benefits_ssdi, t("views.disability_benefits.edit.receiving_benefits_ssdi"), options: { checked_value: "yes", unchecked_value: "no" }) %>
11+
<%= f.cfa_checkbox(:receiving_benefits_ssi, t("views.disability_benefits.edit.receiving_benefits_ssi"), options: { checked_value: "yes", unchecked_value: "no" }) %>
12+
<%= f.cfa_checkbox(:receiving_benefits_veterans_disability, t("views.disability_benefits.edit.receiving_benefits_veterans_disability"), options: { checked_value: "yes", unchecked_value: "no" }) %>
13+
<%= f.cfa_checkbox(:receiving_benefits_disability_pension, t("views.disability_benefits.edit.receiving_benefits_disability_pension"), options: { checked_value: "yes", unchecked_value: "no" }) %>
14+
<%= f.cfa_checkbox(:receiving_benefits_workers_compensation, t("views.disability_benefits.edit.receiving_benefits_workers_compensation"), options: { checked_value: "yes", unchecked_value: "no" }) %>
15+
<%= f.cfa_checkbox(:receiving_benefits_insurance_payments, t("views.disability_benefits.edit.receiving_benefits_insurance_payments"), options: { checked_value: "yes", unchecked_value: "no" }) %>
16+
<%= f.cfa_checkbox(:receiving_benefits_other, t("general.other"), options: { checked_value: "yes", unchecked_value: "no", "data-follow-up": "#write-in" }) %>
17+
<%= f.cfa_checkbox(:receiving_benefits_none, t("general.none_of_the_above"), options: { checked_value: "yes", unchecked_value: "no", id: "none_of_the_above" }) %>
18+
</div>
19+
20+
<div class="question-with-follow-up__follow-up" id="write-in">
21+
<%= f.cfa_input_field(:receiving_benefits_write_in, t("views.disability_benefits.edit.receiving_benefits_write_in")) %>
22+
</div>
23+
</div>
24+
</div>
25+
26+
<%= f.submit t("general.continue"), class: "button button--primary" %>
27+
<% end %>

config/locales/en.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ en:
1010
content_html: This benefits application is a service built by <a target="_blank" rel="noopener nofollow" href="https://www.codeforamerica.org">Code for America</a> in partnership on behalf of the people of the United States.
1111
negative: 'No'
1212
none_of_the_above: None of the above
13+
other: Other
1314
privacy_policy: Privacy Policy
1415
progress_bar_text_html: Section %{step} of 3 <strong>%{section_name}</strong>
1516
work_rules: Work rules
@@ -32,6 +33,16 @@ en:
3233
help_text_html: The person <strong>does not</strong> need to live with you.
3334
notice_text: Caring for someone means you regularly do things like make food, help with daily tasks like bathing and personal care, run errands for them, and monitor their health and wellbeing.
3435
title: Do you care for someone who cannot care for themselves?
36+
disability_benefits:
37+
edit:
38+
receiving_benefits_disability_pension: Disability pension
39+
receiving_benefits_insurance_payments: Disability insurance payments
40+
receiving_benefits_ssdi: Social Security Disability Benefits (SSDI)
41+
receiving_benefits_ssi: SSI (Supplemental Security Income)
42+
receiving_benefits_veterans_disability: Veteran’s disability
43+
receiving_benefits_workers_compensation: Worker’s compensation
44+
receiving_benefits_write_in: If you don’t see your benefit above, please write it here.
45+
title: Are you receiving any of these disability benefits?
3546
has_child:
3647
edit:
3748
help_text: You do not have to be the child’s parent, be responsible for the child, or be their legal guardian. If you live with the child, select “Yes,” even if they aren’t included in your SNAP case.

config/locales/es.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ es:
1010
content_html: This benefits application is a service built by <a target="_blank" rel="noopener nofollow" href="https://www.codeforamerica.org">Code for America</a> in partnership on behalf of the people of the United States.
1111
negative: 'No'
1212
none_of_the_above: Ninguna de las anteriores
13+
other: Otra
1314
privacy_policy: Privacy Policy
1415
progress_bar_text_html: Sección %{step} de 3 <strong>%{section_name}</strong>
1516
work_rules: Reglas de trabajo
@@ -32,6 +33,16 @@ es:
3233
help_text_html: "<strong>No es necesario</strong> que la persona viva con usted."
3334
notice_text: Cuidar a alguien significa que usted regularmente hace cosas como preparar comida, ayudar con tareas diarias como bañarse o asearse, hacer mandados para esa persona y estar pendiente de su salud y bienestar.
3435
title: "¿Cuida usted a alguien que no puede cuidar de sí mismo?"
36+
disability_benefits:
37+
edit:
38+
receiving_benefits_disability_pension: Pensión por discapacidad
39+
receiving_benefits_insurance_payments: Pagos de seguro por discapacidad
40+
receiving_benefits_ssdi: Seguro Social
41+
receiving_benefits_ssi: SSI (Ingreso Suplementario del Seguro Social)
42+
receiving_benefits_veterans_disability: Beneficios de discapacidad para veteranos
43+
receiving_benefits_workers_compensation: Compensación para trabajadores
44+
receiving_benefits_write_in: Si el beneficio que recibe no está en la lista, escríbalo aquí.
45+
title: "¿Recibe alguno de estos beneficios por discapacidad?"
3546
has_child:
3647
edit:
3748
help_text: You do not have to be the child’s parent, be responsible for the child, or be their legal guardian. If you live with the child, select “Yes,” even if they aren’t included in your SNAP case.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class AddDisabilityBenefitsColumnsToScreeners < ActiveRecord::Migration[8.1]
2+
def change
3+
add_column :screeners, :receiving_benefits_ssdi, :integer, null: false, default: 0
4+
add_column :screeners, :receiving_benefits_ssi, :integer, null: false, default: 0
5+
add_column :screeners, :receiving_benefits_veterans_disability, :integer, null: false, default: 0
6+
add_column :screeners, :receiving_benefits_disability_pension, :integer, null: false, default: 0
7+
add_column :screeners, :receiving_benefits_workers_compensation, :integer, null: false, default: 0
8+
add_column :screeners, :receiving_benefits_insurance_payments, :integer, null: false, default: 0
9+
add_column :screeners, :receiving_benefits_other, :integer, null: false, default: 0
10+
add_column :screeners, :receiving_benefits_none, :integer, null: false, default: 0
11+
add_column :screeners, :receiving_benefits_write_in, :string
12+
end
13+
end

db/schema.rb

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)