diff --git a/.gitignore b/.gitignore index 1c22c62..d52db69 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,7 @@ /tmp # Ignore byebug history files -.byebug_history \ No newline at end of file +.byebug_history + +# Ignore IDE +/.idea \ No newline at end of file diff --git a/app/assets/javascripts/sign_ups.coffee b/app/assets/javascripts/sign_ups.coffee index 2763dcb..9bba7db 100644 --- a/app/assets/javascripts/sign_ups.coffee +++ b/app/assets/javascripts/sign_ups.coffee @@ -2,7 +2,8 @@ $(document).on 'ready page:load turbolinks:load', -> $('#return-button').hide() $('#confirm').hide() $('#update').hide() - + $('#children_in_birmingham_form').hide() + $('#member_ids').on 'select2:select', (e) -> $('#participation_member_id').val(e.params.data.id) $('#create').hide() @@ -14,6 +15,7 @@ $(document).on 'ready page:load turbolinks:load', -> $('#phone').text(e.params.data.phone) $('#identity_id').text(e.params.data.identity_id) $('#email').text(e.params.data.email) + $('#children_in_birmingham_school').prop("checked", e.params.data.children_in_birmingham_school) # Revert/clear create form $('#unconfirm, #return-button').on 'click', -> @@ -34,14 +36,18 @@ $(document).on 'ready page:load turbolinks:load', -> selected = e.params.data.text if selected is 'Student' $('#school').show() - $('#graduating').show() + $('#graduating').show() + $('#children_in_birmingham_form').hide() else if selected is 'Parent' or selected is 'Educator' $('#school').show() - $('#graduating').hide() + $('#graduating').hide() + $('#children_in_birmingham_form').show() else $('#school').hide() - $('#graduating').hide() - + $('#graduating').hide() + $('#children_in_birmingham_form').hide() + + # Alter create form for edit, fill with member values $('#update-signup').on 'click', -> $('#confirm').hide() diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index f3626ef..44477c4 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -126,6 +126,6 @@ def filtered_members # Never trust parameters from the scary internet, only allow the white list through. def member_params - params.require(:member).permit(:first_name, :last_name, :phone, :email, :identity, :affiliation, :address, :city, :state, :zip_code, :shirt_size, :shirt_received, :place_of_worship, :recruitment, :community_networks, :extra_groups, :other_networks, :graduating_class_id, :school_id, :identity_id, :organization_ids => [], :neighborhood_ids => [], :extracurricular_activity_ids => [], talent_ids: [], :cohort_ids => []) + params.require(:member).permit(:first_name, :last_name, :phone, :email, :identity, :affiliation, :address, :city, :state, :zip_code, :shirt_size, :shirt_received, :children_in_birmingham_school, :place_of_worship, :recruitment, :community_networks, :extra_groups, :other_networks, :graduating_class_id, :school_id, :identity_id, :organization_ids => [], :neighborhood_ids => [], :extracurricular_activity_ids => [], talent_ids: [], :cohort_ids => []) end end diff --git a/app/controllers/sign_ups_controller.rb b/app/controllers/sign_ups_controller.rb index 7e73b33..af4ffec 100644 --- a/app/controllers/sign_ups_controller.rb +++ b/app/controllers/sign_ups_controller.rb @@ -72,7 +72,7 @@ def update private def member_params - params.permit(member: [:id, :first_name, :last_name, :phone, :email, :identity_id, :school_id, :graduating_class_id])[:member] + params.permit(member: [:id, :first_name, :last_name, :phone, :email, :identity_id, :school_id, :graduating_class_id, :children_in_birmingham_school])[:member] end def participation_params diff --git a/app/views/members/_form.html.erb b/app/views/members/_form.html.erb index a236e3c..060e906 100644 --- a/app/views/members/_form.html.erb +++ b/app/views/members/_form.html.erb @@ -185,6 +185,12 @@ <%= f.text_field :community_networks, class: "form-control" %> +
+ <%= f.label :children_in_birmingham_school, class: "col-sm-2 control-label" %> +
+ <%= f.check_box :children_in_birmingham_school, class: "form-control" %> +
+
<%= f.label :extra_groups, class: "col-sm-2 control-label" %>
diff --git a/app/views/members/index.json.jbuilder b/app/views/members/index.json.jbuilder index 68ce7c2..2dff0d3 100644 --- a/app/views/members/index.json.jbuilder +++ b/app/views/members/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@members) do |member| - json.extract! member, :id, :text, :first_name, :last_name, :phone, :email, :identity_id, :school_id, :graduating_class_id + json.extract! member, :id, :text, :first_name, :last_name, :phone, :email, :identity_id, :school_id, :graduating_class_id, :children_in_birmingham_school json.url member_url(member, format: :json) end diff --git a/app/views/members/show.html.erb b/app/views/members/show.html.erb index 7a9d1c4..15bb126 100644 --- a/app/views/members/show.html.erb +++ b/app/views/members/show.html.erb @@ -86,7 +86,8 @@
<% end %> -
Extracurricular Activities:
+
Extracurricular
+
Activities:
<% if @member.extracurricular_activities.present? %> <%= content_tag_for(:dd, @member.extracurricular_activities) do |extracurricular_activity| %> <%= link_to extracurricular_activity.name, extracurricular_activity %> @@ -101,6 +102,11 @@
Recruitment:
<%= @member.recruitment %>
+
Children in
+
+
Birmingham School:
+
<%= @member.children_in_birmingham_school %>
+
Community networks:
<%= @member.community_networks %>
diff --git a/app/views/sign_ups/_confirm.html.erb b/app/views/sign_ups/_confirm.html.erb index 4ff6ead..9682741 100644 --- a/app/views/sign_ups/_confirm.html.erb +++ b/app/views/sign_ups/_confirm.html.erb @@ -19,7 +19,12 @@
Identity:
- + +
Children in
+
+
Birmingham School:
+
+ <%= f.hidden_field :member_id %> <%= f.hidden_field :level %> diff --git a/app/views/sign_ups/_form.html.erb b/app/views/sign_ups/_form.html.erb index 6cede69..e697445 100644 --- a/app/views/sign_ups/_form.html.erb +++ b/app/views/sign_ups/_form.html.erb @@ -67,13 +67,21 @@
-
- <%= render :partial => 'school', locals: { f: f} %> -
-
- <%= render :partial => 'graduating', locals: { f: f} %> +
+ <%= render :partial => 'school', locals: { f: f} %> +
+ +
+ <%= render :partial => 'graduating', locals: { f: f} %> +
+ +
+ <%= f.label :children_in_birmingham_school, class: "col-sm-2 control-label" %> +
+ <%= f.check_box :children_in_birmingham_school, class: "form-control" %>
- +
+
<%= hidden_field_tag :member_id, @member_id %> <%= hidden_field_tag :level, @level %> diff --git a/db/migrate/20170201171838_add_children_in_birmingham_school_to_members.rb b/db/migrate/20170201171838_add_children_in_birmingham_school_to_members.rb new file mode 100644 index 0000000..ae1a2d5 --- /dev/null +++ b/db/migrate/20170201171838_add_children_in_birmingham_school_to_members.rb @@ -0,0 +1,5 @@ +class AddChildrenInSchoolToMembers < ActiveRecord::Migration + def change + add_column :members, :children_in_school, :boolean + end +end diff --git a/db/migrate/20170201183152_fix_children_in_birmingham_school_name.rb b/db/migrate/20170201183152_fix_children_in_birmingham_school_name.rb new file mode 100644 index 0000000..a754a35 --- /dev/null +++ b/db/migrate/20170201183152_fix_children_in_birmingham_school_name.rb @@ -0,0 +1,5 @@ +class FixChildrenInBirminghamSchoolName < ActiveRecord::Migration + def change + rename_column :members, :children_in_school, :children_in_birmingham_school + end +end diff --git a/db/schema.rb b/db/schema.rb index 8502e74..e3b8c81 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -136,11 +136,12 @@ t.string "extra_groups" t.string "other_networks" t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.integer "graduating_class_id" t.integer "school_id" t.string "mongo_id" + t.boolean "children_in_birmingham_school" t.integer "identity_id" t.index ["identity_id"], name: "index_members_on_identity_id" end