Skip to content

Commit ea1d7a5

Browse files
authored
Add unemployment benefits page (#69)
1 parent 3e92c31 commit ea1d7a5

File tree

11 files changed

+54
-15
lines changed

11 files changed

+54
-15
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class HasUnemploymentBenefitsController < QuestionController
2+
include WrExemptionsConcern
3+
4+
def self.attributes_edited
5+
[:has_unemployment_benefits]
6+
end
7+
end

app/controllers/navigation/screener_navigation.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class ScreenerNavigation < ControllerNavigation::ControllerNavigation
88
ControllerNavigation::NavigationStep.new(AmericanIndianController),
99
ControllerNavigation::NavigationStep.new(HasChildController),
1010
ControllerNavigation::NavigationStep.new(CaringForSomeoneController),
11+
ControllerNavigation::NavigationStep.new(HasUnemploymentBenefitsController),
1112
ControllerNavigation::NavigationStep.new(BasicInfoMilestoneController),
1213
ControllerNavigation::NavigationStep.new(PersonalInformationController),
1314
ControllerNavigation::NavigationStep.new(TempEndController)

app/models/screener.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Screener < ApplicationRecord
77
enum :caring_for_child_under_6, {unfilled: 0, yes: 1, no: 2}, prefix: true
88
enum :caring_for_disabled_or_ill_person, {unfilled: 0, yes: 1, no: 2}, prefix: true
99
enum :caring_for_no_one, {unfilled: 0, yes: 1, no: 2}, prefix: true
10+
enum :has_unemployment_benefits, {unfilled: 0, yes: 1, no: 2}, prefix: true
1011
attr_writer :birth_date_year, :birth_date_month, :birth_date_day
1112
normalizes :phone_number, with: ->(value) { Phonelib.parse(value, "US").national }
1213

@@ -36,6 +37,10 @@ class Screener < ApplicationRecord
3637
validates :caring_for_no_one, inclusion: {in: %w[unfilled no]}, if: -> { caring_for_child_under_6_yes? || caring_for_disabled_or_ill_person_yes? }
3738
end
3839

40+
with_context :has_unemployment_benefits do
41+
validates :has_unemployment_benefits, inclusion: {in: %w[yes no], message: I18n.t("validations.must_answer_yes_or_no")}
42+
end
43+
3944
def locale
4045
language_preference_written_spanish? ? :es : :en
4146
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% content_for :question_title, t("views.has_unemployment_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+
<%= render "shared/yes_no_buttons", form: f, model_name: @model.class.name.downcase, column: "has_unemployment_benefits" %>
7+
<% end %>
8+

config/locales/en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ en:
3535
edit:
3636
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.
3737
title: Is there a child under the age of 14 that lives in your household?
38+
has_unemployment_benefits:
39+
edit:
40+
title: Do you get, or are you applying for unemployment benefits?
3841
landing_page:
3942
fill_out_form: Fill out the form
4043
index:

config/locales/es.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ es:
3535
edit:
3636
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.
3737
title: Is there a child under the age of 14 that lives in your household?
38+
has_unemployment_benefits:
39+
edit:
40+
title: "¿Recibe o está solicitando beneficios de desempleo?"
3841
landing_page:
3942
fill_out_form: Complete el formulario
4043
index:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddHasUnemploymentBenefitsToScreeners < ActiveRecord::Migration[8.1]
2+
def change
3+
add_column :screeners, :has_unemployment_benefits, :integer, null: false, default: 0
4+
end
5+
end

db/queue_schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 0) do
13+
ActiveRecord::Schema[8.1].define(version: 0) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616
end

db/schema.rb

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

spec/features/flow_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525

2626
expect(page).to have_selector("h1", text: I18n.t("views.caring_for_someone.edit.title"))
2727
check I18n.t("general.none_of_the_above")
28-
2928
click_on I18n.t("general.continue")
3029

30+
expect(page).to have_selector("h1", text: I18n.t("views.has_unemployment_benefits.edit.title"))
31+
click_on I18n.t("general.negative")
32+
3133
expect(page).to have_selector("h1", text: I18n.t("views.basic_info_milestone.edit.title"))
3234
click_on I18n.t("general.continue")
3335

0 commit comments

Comments
 (0)