Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/assets/stylesheets/bootstrap.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/children_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ def child_params
params.require(:child).permit(
:active,
:agency_child_id,
:child_lives_with,
:comments,
:date_of_birth,
:first_name,
:gender,
:health_insurance,
:item_needed_diaperid,
:last_name,
:race
:race,
:archived,
child_lives_with: []
)
end
end
4 changes: 2 additions & 2 deletions app/controllers/families_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def family_params
:home_adult_count,
:home_child_count,
:home_young_child_count,
:sources_of_income,
:military
:military,
sources_of_income: []
)
end
end
2 changes: 2 additions & 0 deletions app/models/child.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#

class Child < ApplicationRecord
CAN_LIVE_WITH = %w[Mother Father Grandparent Foster\ Parent Other\ Parent/Relative].freeze
serialize :child_lives_with, Array
belongs_to :family
has_many :family_request_child, dependent: :destroy
has_many :family_requests, through: :family_request_child
Expand Down
3 changes: 3 additions & 0 deletions app/models/family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class Family < ApplicationRecord
belongs_to :partner
has_many :children, dependent: :destroy
has_many :authorized_family_members, dependent: :destroy
serialize :sources_of_income, Array

INCOME_TYPES = %w[SSI SNAP/FOOD\ Stamps TANF WIC Housing/subsidized Housing/unsubsidized N/A].freeze

def guardian_display_name
"#{guardian_first_name} #{guardian_last_name}"
Expand Down
2 changes: 1 addition & 1 deletion app/models/partner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
class Partner < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
ACTIVE_FAMILY_REQUESTS = [3, 27].freeze
ACTIVE_FAMILY_REQUESTS = [1, 3, 27].freeze

devise :invitable, :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
Expand Down
21 changes: 18 additions & 3 deletions app/views/children/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@
<div class="form-horizontal">
<div class="form-group row">
<%= form.label :child_lives_with, class: "control-label col-md-3"%>
<%= form.text_field :child_lives_with, class: "col-md-8 form-control" %>
<% Child::CAN_LIVE_WITH.each do |a_value| %>
<%= form.check_box(:child_lives_with, { :multiple => true }, a_value, nil) %>
<%= form.label "#{a_value}" %>
<% end %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :race, class: "control-label col-md-3" %>
<%= form.select :race, ["African American", "Caucasian", "Hispanic", "Asian", "American Indian", "Pacific Islander", "Multi-racial", "Other"], class: "col-md-8 form-control" %>
<%= form.select :race, ["African American", "Caucasian", "Hispanic", "Asian", "American Indian", "Pacific Islander", "Multi-racial", "Other"], class: "col-md-8 form-control", :include_blank => true %>
</div>
</div>

Expand All @@ -70,7 +73,12 @@
<div class="form-horizontal">
<div class="form-group row">
<%= form.label :health_insurance, class: "control-label col-md-3"%>
<%= form.text_field :health_insurance, class: "col-md-8 form-control" %>
<%= form.radio_button :health_insurance, 'Private Insurance' %>
<%= label :health_insurance, 'Private Insurance' %>
<%= form.radio_button :health_insurance, 'Medicaid' %>
<%= label :health_insurance, 'Medicaid' %>
<%= form.radio_button :health_insurance, 'Uninsured' %>
<%= label :health_insurance, 'Uninsured' %>
</div>
</div>

Expand Down Expand Up @@ -105,6 +113,13 @@
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label "Archived?", class: "control-label col-md-3"%>
<%= form.check_box :archived, class: "col-md-8 form-control" %>
</div>
</div>

<div class="actions">
<%= form.submit(class: 'btn btn-primary') %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/children/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dd><%= child.gender %></dd>

<dt>Child lives with:</dt>
<dd><%= child.child_lives_with %></dd>
<dd><%= child.child_lives_with.join(', ') %></dd>

<dt>Race:</dt>
<dd><%= child.race %></dd>
Expand Down
42 changes: 28 additions & 14 deletions app/views/families/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :guardian_country, class: "control-label col-md-3" %>
<%= form.label :guardian_country, "Guardian County", class: "control-label col-md-3" %>
<%= form.text_field :guardian_country, class: "col-md-8 form-control" %>
</div>
</div>
Expand All @@ -60,43 +60,54 @@

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :home_adult_count, class: "control-label col-md-3" %>
<%= form.label :home_adult_count, "Number of Adults Living In The Home", class: "control-label col-md-3" %>
<%= form.number_field :home_adult_count, class: "col-md-8 form-control" %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :home_child_count, class: "control-label col-md-3" %>
<%= form.label :home_child_count, 'How Many Children (5-17) Live In the Home?', class: "control-label col-md-3" %>
<%= form.number_field :home_child_count, class: "col-md-8 form-control" %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :home_young_child_count, class: "control-label col-md-3" %>
<%= form.label :home_young_child_count, 'How Many Children (under 5) Live in the Home?', class: "control-label col-md-3" %>
<%= form.number_field :home_young_child_count, class: "col-md-8 form-control" %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :sources_of_income, class: "control-label col-md-3" %>
<%= form.text_field :sources_of_income, class: "col-md-8 form-control" %>
<%= form.label :sources_of_income, class: "control-label col-md-3"%>
<% Family::INCOME_TYPES.each do |a_value| %>
<%= form.check_box(:sources_of_income, { :multiple => true }, a_value, nil) %>
<%= form.label "#{a_value}" %>
<% end %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :guardian_employed, class: "control-label col-md-3" %>
<%= form.check_box :guardian_employed, class: "col-md-8 form-control" %>
<%= form.label :guardian_employed, "Is The Parent/Guardian Employed?", class: "control-label col-md-3" %>
<%= form.radio_button :guardian_employed, 'Yes' %>
<%= label :guardian_employed, 'Yes' %>
<%= form.radio_button :guardian_employed, 'No' %>
<%= label :guardian_employed, 'No' %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :guardian_employment_type, class: "control-label col-md-3" %>
<%= form.text_field :guardian_employment_type, class: "col-md-8 form-control" %>
<%= form.label :guardian_employment_type, "Full-Time or Part-Time", class: "control-label col-md-3" %>
<%= form.radio_button :guardian_employment_type, 'Full-Time' %>
<%= label :guardian_employment_type, 'Full-Time' %>
<%= form.radio_button :guardian_employment_type, 'Part-Time' %>
<%= label :guardian_employment_type, 'Part-Time' %>
<%= form.radio_button :guardian_employment_type, 'N/A' %>
<%= label :guardian_employment_type, 'N/A' %>
</div>
</div>

Expand All @@ -109,19 +120,22 @@

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :guardian_health_insurance, class: "control-label col-md-3" %>
<%= form.text_field :guardian_health_insurance, class: "col-md-8 form-control" %>
<%= form.label :guardian_health_insurance, class: "control-label col-md-3"%>
<%= form.radio_button :guardian_health_insurance, 'Private Insurance' %>
<%= label :guardian_health_insurance, 'Private Insurance' %>
<%= form.radio_button :guardian_health_insurance, 'Medicaid' %>
<%= label :guardian_health_insurance, 'Medicaid' %>
<%= form.radio_button :guardian_health_insurance, 'Uninsured' %>
<%= label :guardian_health_insurance, 'Uninsured' %>
</div>
</div>

<div class="form-horizontal">
<div class="form-group row">
<%= form.label :military, "Military Family", class: "control-label col-md-3" %>
<div class="form-control col-md-8">
<%= form.radio_button :military, true %> Yes
&nbsp;
<%= form.radio_button :military, false %> No
</div>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions app/views/families/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<dt>Guardian zip code:</dt>
<dd><%= family.guardian_zip_code %></dd>

<dt>Guardian country:</dt>
<dt>Guardian county:</dt>
<dd><%= family.guardian_country %></dd>

<dt>Guardian phone:</dt>
Expand All @@ -53,7 +53,7 @@
<dd><%= family.home_young_child_count %></dd>

<dt>Sources of income:</dt>
<dd><%= family.sources_of_income %></dd>
<dd><%= family.sources_of_income.join(', ') %></dd>

<dt>Guardian employed:</dt>
<dd><%= family.guardian_employed %></dd>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20190721044143_add_archived_to_child.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddArchivedToChild < ActiveRecord::Migration[5.2]
def change
add_column :children, :archived, :boolean
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_07_08_185154) do
ActiveRecord::Schema.define(version: 2019_07_21_044143) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -63,6 +63,7 @@
t.bigint "family_id"
t.integer "item_needed_diaperid"
t.boolean "active", default: true
t.boolean "archived"
t.index ["family_id"], name: "index_children_on_family_id"
end

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/children.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
date_of_birth { Faker::Date.backward(14).iso8601 }
active { true }
gender { Faker::Gender.type }
child_lives_with { "Parent" }
child_lives_with { ["Mother"] }
race { "Unknown" }
item_needed_diaperid { 1 }
agency_child_id { "Agency" }
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/families.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
home_adult_count { 1 }
home_child_count { 1 }
home_young_child_count { 1 }
sources_of_income { "" }
sources_of_income { ["WIC"] }
guardian_employed { false }
guardian_employment_type { "" }
guardian_monthly_pay { "9.99" }
guardian_health_insurance { "" }
guardian_health_insurance { "Uninsured" }
military { false }
comments { "MyText" }
partner
Expand Down