From b9060ff37fcfd51df73e11ec0674674be241ad2c Mon Sep 17 00:00:00 2001 From: su20yu1919 Date: Wed, 1 Feb 2017 15:43:28 -0500 Subject: [PATCH 1/3] Added Indicator To Determine Whether Member has a children at Birmingham School --- .idea/dictionaries/billsu.xml | 3 +++ .idea/vcs.xml | 6 ++++++ app/assets/javascripts/sign_ups.coffee | 17 ++++++++++++----- app/controllers/members_controller.rb | 2 +- app/controllers/sign_ups_controller.rb | 2 +- app/views/members/_form.html.erb | 6 ++++++ app/views/members/index.json.jbuilder | 2 +- app/views/members/show.html.erb | 8 +++++++- app/views/sign_ups/_confirm.html.erb | 7 ++++++- app/views/sign_ups/_form.html.erb | 20 ++++++++++++++------ db/schema.rb | 7 ++++--- 11 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 .idea/dictionaries/billsu.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/dictionaries/billsu.xml b/.idea/dictionaries/billsu.xml new file mode 100644 index 0000000..0ff2267 --- /dev/null +++ b/.idea/dictionaries/billsu.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/assets/javascripts/sign_ups.coffee b/app/assets/javascripts/sign_ups.coffee index 1a4cb26..61de54e 100644 --- a/app/assets/javascripts/sign_ups.coffee +++ b/app/assets/javascripts/sign_ups.coffee @@ -2,9 +2,11 @@ $(document).on 'ready page: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) + console.log(e) $('#create').hide() $('#update').hide() $('#member_ids').html() @@ -14,6 +16,7 @@ $(document).on 'ready page:load', -> $('#phone').text(e.params.data.phone) $('#identity').text(e.params.data.identity) $('#email').text(e.params.data.email) + $('#children_in_birmingham_school').text(e.params.data.children_in_birmingham_school) # Revert/clear create form $('#unconfirm, #return-button').on 'click', -> @@ -34,14 +37,18 @@ $(document).on 'ready page: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 9062852..271e62b 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -76,6 +76,6 @@ def set_member # 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, :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, :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 674883e..42f7de9 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, :school_id, :graduating_class_id])[:member] + params.permit(member: [:id, :first_name, :last_name, :phone, :email, :identity, :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 30b0aa7..48a0bb2 100644 --- a/app/views/members/_form.html.erb +++ b/app/views/members/_form.html.erb @@ -181,6 +181,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 546f0eb..d3eff57 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, :school_id, :graduating_class_id + json.extract! member, :id, :text, :first_name, :last_name, :phone, :email, :identity, :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 07b20ce..a7d98a0 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 6c11dbb..67702cd 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 c673d62..45add4c 100644 --- a/app/views/sign_ups/_form.html.erb +++ b/app/views/sign_ups/_form.html.erb @@ -63,13 +63,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/schema.rb b/db/schema.rb index b8c1bd4..7a5ff73 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170108211004) do +ActiveRecord::Schema.define(version: 20170201183152) do create_table "affiliations", force: :cascade do |t| t.integer "member_id" @@ -121,11 +121,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" end create_table "neighborhoods", force: :cascade do |t| From e93d726e0f3377d33c794a4f9eede5ee837bb128 Mon Sep 17 00:00:00 2001 From: su20yu1919 Date: Fri, 16 Jun 2017 03:15:54 +0800 Subject: [PATCH 2/3] modified pull request as requested --- .gitignore | 5 ++++- app/assets/javascripts/sign_ups.coffee | 3 +-- ...201171838_add_children_in_birmingham_school_to_members.rb | 5 +++++ .../20170201183152_fix_children_in_birmingham_school_name.rb | 5 +++++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20170201171838_add_children_in_birmingham_school_to_members.rb create mode 100644 db/migrate/20170201183152_fix_children_in_birmingham_school_name.rb 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 61de54e..ca21502 100644 --- a/app/assets/javascripts/sign_ups.coffee +++ b/app/assets/javascripts/sign_ups.coffee @@ -6,7 +6,6 @@ $(document).on 'ready page:load', -> $('#member_ids').on 'select2:select', (e) -> $('#participation_member_id').val(e.params.data.id) - console.log(e) $('#create').hide() $('#update').hide() $('#member_ids').html() @@ -16,7 +15,7 @@ $(document).on 'ready page:load', -> $('#phone').text(e.params.data.phone) $('#identity').text(e.params.data.identity) $('#email').text(e.params.data.email) - $('#children_in_birmingham_school').text(e.params.data.children_in_birmingham_school) + $('#children_in_birmingham_school').prop("checked", e.params.data.children_in_birmingham_school) # Revert/clear create form $('#unconfirm, #return-button').on 'click', -> 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 From 8fb18c0dd1175452213861786983ebd57fc865f9 Mon Sep 17 00:00:00 2001 From: su20yu1919 Date: Fri, 16 Jun 2017 03:33:48 +0800 Subject: [PATCH 3/3] removed ide folders --- .idea/dictionaries/billsu.xml | 3 --- .idea/vcs.xml | 6 ------ 2 files changed, 9 deletions(-) delete mode 100644 .idea/dictionaries/billsu.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/dictionaries/billsu.xml b/.idea/dictionaries/billsu.xml deleted file mode 100644 index 0ff2267..0000000 --- a/.idea/dictionaries/billsu.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file