diff --git a/app/assets/stylesheets/bootstrap.min.css b/app/assets/stylesheets/bootstrap.min.css index 555d7ba0..fadefcf5 100644 --- a/app/assets/stylesheets/bootstrap.min.css +++ b/app/assets/stylesheets/bootstrap.min.css @@ -258,7 +258,6 @@ button, select, optgroup, textarea { - margin: 0; font-family: inherit; font-size: inherit; line-height: inherit; diff --git a/app/controllers/children_controller.rb b/app/controllers/children_controller.rb index 85eafbe2..3bd51b5f 100644 --- a/app/controllers/children_controller.rb +++ b/app/controllers/children_controller.rb @@ -70,7 +70,6 @@ def child_params params.require(:child).permit( :active, :agency_child_id, - :child_lives_with, :comments, :date_of_birth, :first_name, @@ -78,7 +77,9 @@ def child_params :health_insurance, :item_needed_diaperid, :last_name, - :race + :race, + :archived, + child_lives_with: [] ) end end diff --git a/app/controllers/families_controller.rb b/app/controllers/families_controller.rb index 803fb4a3..65b7cc21 100644 --- a/app/controllers/families_controller.rb +++ b/app/controllers/families_controller.rb @@ -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 diff --git a/app/models/child.rb b/app/models/child.rb index eb5bb1ce..cd9daf22 100644 --- a/app/models/child.rb +++ b/app/models/child.rb @@ -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 diff --git a/app/models/family.rb b/app/models/family.rb index b636b92e..7a733fa9 100644 --- a/app/models/family.rb +++ b/app/models/family.rb @@ -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}" diff --git a/app/models/partner.rb b/app/models/partner.rb index cd680126..04b8f5b8 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -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 diff --git a/app/views/children/_form.html.erb b/app/views/children/_form.html.erb index c67aa1c8..c8faa74a 100644 --- a/app/views/children/_form.html.erb +++ b/app/views/children/_form.html.erb @@ -49,14 +49,17 @@
<%= 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 %>
<%= 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 %>
@@ -70,7 +73,12 @@
<%= 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' %>
@@ -105,6 +113,13 @@ +
+
+ <%= form.label "Archived?", class: "control-label col-md-3"%> + <%= form.check_box :archived, class: "col-md-8 form-control" %> +
+
+
<%= form.submit(class: 'btn btn-primary') %>
diff --git a/app/views/children/show.html.erb b/app/views/children/show.html.erb index 5ff25ff1..44cbee81 100644 --- a/app/views/children/show.html.erb +++ b/app/views/children/show.html.erb @@ -36,7 +36,7 @@
<%= child.gender %>
Child lives with:
-
<%= child.child_lives_with %>
+
<%= child.child_lives_with.join(', ') %>
Race:
<%= child.race %>
diff --git a/app/views/families/_form.html.erb b/app/views/families/_form.html.erb index 0650f3d1..8a10a577 100644 --- a/app/views/families/_form.html.erb +++ b/app/views/families/_form.html.erb @@ -39,7 +39,7 @@
- <%= 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" %>
@@ -60,43 +60,54 @@
- <%= 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" %>
- <%= 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" %>
- <%= 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" %>
- <%= 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 %>
- <%= 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' %>
- <%= 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' %>
@@ -109,19 +120,22 @@
- <%= 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' %>
<%= form.label :military, "Military Family", class: "control-label col-md-3" %> -
<%= form.radio_button :military, true %> Yes   <%= form.radio_button :military, false %> No -
diff --git a/app/views/families/show.html.erb b/app/views/families/show.html.erb index d27ffb75..615da022 100644 --- a/app/views/families/show.html.erb +++ b/app/views/families/show.html.erb @@ -34,7 +34,7 @@
Guardian zip code:
<%= family.guardian_zip_code %>
-
Guardian country:
+
Guardian county:
<%= family.guardian_country %>
Guardian phone:
@@ -53,7 +53,7 @@
<%= family.home_young_child_count %>
Sources of income:
-
<%= family.sources_of_income %>
+
<%= family.sources_of_income.join(', ') %>
Guardian employed:
<%= family.guardian_employed %>
diff --git a/db/migrate/20190721044143_add_archived_to_child.rb b/db/migrate/20190721044143_add_archived_to_child.rb new file mode 100644 index 00000000..7691243d --- /dev/null +++ b/db/migrate/20190721044143_add_archived_to_child.rb @@ -0,0 +1,5 @@ +class AddArchivedToChild < ActiveRecord::Migration[5.2] + def change + add_column :children, :archived, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 9e0eec6c..b4b93acb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" @@ -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 diff --git a/spec/factories/children.rb b/spec/factories/children.rb index 0ff44293..0972fcf1 100644 --- a/spec/factories/children.rb +++ b/spec/factories/children.rb @@ -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" } diff --git a/spec/factories/families.rb b/spec/factories/families.rb index c732186b..17cb59ac 100644 --- a/spec/factories/families.rb +++ b/spec/factories/families.rb @@ -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