Skip to content

Commit af1e944

Browse files
authored
WRSAT-191 create personal situations preventing work screen (#77)
1 parent 12b8bdc commit af1e944

File tree

13 files changed

+207
-18
lines changed

13 files changed

+207
-18
lines changed

app/controllers/navigation/screener_navigation.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ScreenerNavigation < ControllerNavigation::ControllerNavigation
1414
ControllerNavigation::NavigationStep.new(CommunityServiceController),
1515
ControllerNavigation::NavigationStep.new(IsStudentController),
1616
ControllerNavigation::NavigationStep.new(PersonalSituationsMilestoneController),
17+
ControllerNavigation::NavigationStep.new(PreventingWorkController),
1718
ControllerNavigation::NavigationStep.new(BasicInfoMilestoneController),
1819
ControllerNavigation::NavigationStep.new(PersonalInformationController),
1920
ControllerNavigation::NavigationStep.new(EmailController),
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class PreventingWorkController < QuestionController
2+
include PersonalSituationsConcern
3+
4+
def self.attributes_edited
5+
[
6+
:preventing_work_place_to_sleep,
7+
:preventing_work_drugs_alcohol,
8+
:preventing_work_domestic_violence,
9+
:preventing_work_medical_condition,
10+
:preventing_work_other,
11+
:preventing_work_none,
12+
:preventing_work_write_in
13+
]
14+
end
15+
end

app/models/screener.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ class Screener < ApplicationRecord
2020
enum :receiving_benefits_other, {unfilled: 0, yes: 1, no: 2}, prefix: true
2121
enum :receiving_benefits_none, {unfilled: 0, yes: 1, no: 2}, prefix: true
2222
enum :is_student, {unfilled: 0, yes: 1, no: 2}, prefix: true
23+
enum :preventing_work_place_to_sleep, {unfilled: 0, yes: 1, no: 2}, prefix: true
24+
enum :preventing_work_drugs_alcohol, {unfilled: 0, yes: 1, no: 2}, prefix: true
25+
enum :preventing_work_domestic_violence, {unfilled: 0, yes: 1, no: 2}, prefix: true
26+
enum :preventing_work_medical_condition, {unfilled: 0, yes: 1, no: 2}, prefix: true
27+
enum :preventing_work_other, {unfilled: 0, yes: 1, no: 2}, prefix: true
28+
enum :preventing_work_none, {unfilled: 0, yes: 1, no: 2}, prefix: true
2329
attr_writer :birth_date_year, :birth_date_month, :birth_date_day
2430
attr_writer :pregnancy_due_date_year, :pregnancy_due_date_month, :pregnancy_due_date_day
2531
normalizes :phone_number, with: ->(value) { Phonelib.parse(value, "US").national }
@@ -80,6 +86,18 @@ class Screener < ApplicationRecord
8086
validates :is_student, inclusion: {in: %w[yes no], message: I18n.t("validations.must_answer_yes_or_no")}
8187
end
8288

89+
with_context :preventing_work do
90+
validates :preventing_work_none, inclusion: {in: %w[unfilled no]},
91+
if: -> {
92+
preventing_work_place_to_sleep_yes? ||
93+
preventing_work_drugs_alcohol_yes? ||
94+
preventing_work_domestic_violence_yes? ||
95+
preventing_work_medical_condition_yes? ||
96+
preventing_work_other_yes?
97+
}
98+
validates :preventing_work_write_in, absence: true, if: -> { preventing_work_other_no? }
99+
end
100+
83101
with_context :email do
84102
validates :email, "valid_email_2/email": true, confirmation: true
85103
end

app/views/community_service/edit.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</div>
1515

1616
<div class="question-with-follow-up__follow-up" id="hours-and-org">
17-
<hr class="spacing-above-0" />
18-
<%= f.cfa_input_field(:volunteering_hours, t("views.community_service.edit.volunteering_hours_label"), help_text: t("views.community_service.edit.volunteering_hours_label_help_text")) %>
17+
` <hr class="spacing-above-0" />
18+
` <%= f.cfa_input_field(:volunteering_hours, t("views.community_service.edit.volunteering_hours_label"), help_text: t("views.community_service.edit.volunteering_hours_label_help_text")) %>
1919
<%= f.cfa_input_field(:volunteering_org_name, t("views.community_service.edit.volunteering_org_label")) %>
2020
</div>
2121
</div>

app/views/disability_benefits/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h1 class="h2"><%= content_for(:question_title) %></h1>
44

55
<%= 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: "" %>
6+
<%= f.hidden_field :receiving_benefits_write_in, value: nil %>
77
<div class="checkbox-group">
88
<div class="question-with-follow-up">
99
<div class="question-with-follow-up__question">
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<% content_for :question_title, t("views.preventing_work.edit.title") %>
2+
3+
<h1 class="h2"><%= content_for(:question_title) %></h1>
4+
5+
<p class="text--help">
6+
<%= t("views.preventing_work.edit.choose_all_that_apply") %>
7+
</p>
8+
9+
<%= form_with model: @model, url: { action: :update }, data: { turbo: false }, local: true, method: "put", builder: Cfa::Styleguide::CfaFormBuilder do |f| %>
10+
<%= f.hidden_field :preventing_work_write_in, value: nil %>
11+
<div class="checkbox-group">
12+
<div class="question-with-follow-up">
13+
<div class="question-with-follow-up__question">
14+
<%= f.cfa_checkbox(:preventing_work_place_to_sleep, t("views.preventing_work.edit.preventing_work_place_to_sleep"), options: { checked_value: "yes", unchecked_value: "no" }) %>
15+
<%= f.cfa_checkbox(:preventing_work_drugs_alcohol, t("views.preventing_work.edit.preventing_work_drugs_alcohol"), options: { checked_value: "yes", unchecked_value: "no" }) %>
16+
<%= f.cfa_checkbox(:preventing_work_domestic_violence, t("views.preventing_work.edit.preventing_work_domestic_violence"), options: { checked_value: "yes", unchecked_value: "no" }) %>
17+
<%= f.cfa_checkbox(:preventing_work_medical_condition, t("views.preventing_work.edit.preventing_work_medical_condition_html"), options: { checked_value: "yes", unchecked_value: "no" }) %>
18+
<%= f.cfa_checkbox(:preventing_work_other, t("views.preventing_work.edit.other"), options: { checked_value: "yes", unchecked_value: "no", "data-follow-up": "#write-in" }) %>
19+
<%= f.cfa_checkbox(:preventing_work_none, t("general.none_of_the_above"), options: { checked_value: "yes", unchecked_value: "no", id: "none_of_the_above" }) %>
20+
</div>
21+
22+
<div class="question-with-follow-up__follow-up" id="write-in">
23+
<hr class="spacing-above-0" />
24+
<%= f.cfa_input_field(:preventing_work_write_in, t("views.preventing_work.edit.preventing_work_write_in")) %>
25+
</div>
26+
</div>
27+
</div>
28+
29+
<%= f.submit t("general.continue"), class: "button button--primary" %>
30+
<% end %>

config/locales/en.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ en:
150150
edit:
151151
help_text_html: We know these are sensitive topics. Sharing this information could help your agency decide that you do not have to meet work rules to get SNAP benefits.
152152
title: Situations that make it hard to work
153+
preventing_work:
154+
edit:
155+
choose_all_that_apply: Choose all that apply.
156+
other: Other
157+
preventing_work_domestic_violence: Experiencing domestic violence
158+
preventing_work_drugs_alcohol: Struggling with drugs or alcohol
159+
preventing_work_medical_condition_html: |
160+
A medical condition
161+
<br/>
162+
<span class="text--help">This includes physical and mental health issues.</span>
163+
preventing_work_place_to_sleep: Do not have a regular place to sleep and shower
164+
preventing_work_write_in: If you have another reason, please write it here.
165+
title: Are any of these things preventing you from working at least 20 hours a week?
153166
receiving_benefits:
154167
edit:
155168
is_no: No, but I applied or might apply later

config/locales/es.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ es:
150150
edit:
151151
help_text_html: Sabemos que estos son temas delicados. Compartir esta información puede ayudar a su agencia a decidir que usted no debe cumplir con las nuevas reglas de trabajo para recibir beneficios de SNAP.
152152
title: Situaciones que hacen difícil que trabaje
153+
preventing_work:
154+
edit:
155+
choose_all_that_apply: Seleccione todas las que correspondan.
156+
other: Otra razón
157+
preventing_work_domestic_violence: Violencia doméstica
158+
preventing_work_drugs_alcohol: Dificultades con el consumo de drogas o alcohol
159+
preventing_work_medical_condition_html: |
160+
Tiene una condición médica
161+
<br/>
162+
<span class="text--help">Esto incluye un problema físico, mental u otra situación personal.</span>
163+
preventing_work_place_to_sleep: Falta de vivienda estable (sin hogar de forma continua)
164+
preventing_work_write_in: Si tiene otra razón, escríbala aquí.
165+
title: "¿Alguna de estas situaciones le impide trabajar al menos 20 horas a la semana?"
153166
receiving_benefits:
154167
edit:
155168
is_no: No, pero presenté una solicitud o es posible que presente una más adelante
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class AddPreventingWorkColumnsToScreeners < ActiveRecord::Migration[8.1]
2+
def change
3+
add_column :screeners, :preventing_work_place_to_sleep, :integer, null: false, default: 0
4+
add_column :screeners, :preventing_work_drugs_alcohol, :integer, null: false, default: 0
5+
add_column :screeners, :preventing_work_domestic_violence, :integer, null: false, default: 0
6+
add_column :screeners, :preventing_work_medical_condition, :integer, null: false, default: 0
7+
add_column :screeners, :preventing_work_other, :integer, null: false, default: 0
8+
add_column :screeners, :preventing_work_none, :integer, null: false, default: 0
9+
add_column :screeners, :preventing_work_write_in, :string
10+
end
11+
end

db/schema.rb

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)