Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Indicator To Determine Whether Member has a children at Birmingham School #461

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .idea/dictionaries/billsu.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions app/assets/javascripts/sign_ups.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug lines should not be included in the pull request.

$('#create').hide()
$('#update').hide()
$('#member_ids').html()
Expand All @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be the way to check the checkbox with jQuery. See https://learn.jquery.com/using-jquery-core/faq/how-do-i-check-uncheck-a-checkbox-input-or-radio-button/

Maybe something like...

$('#children_in_birmingham_school').prop( "checked", e.params.data.children_in_birmingham_school )


# Revert/clear create form
$('#unconfirm, #return-button').on 'click', ->
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/controllers/sign_ups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions app/views/members/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@
<%= f.text_field :community_networks, class: "form-control" %>
</div>
</div>
<div class="form-group">
<%= f.label :children_in_birmingham_school, class: "col-sm-2 control-label" %>
<div class="col-sm-10">
<%= f.check_box :children_in_birmingham_school, class: "form-control" %>
</div>
</div>
<div class="form-group">
<%= f.label :extra_groups, class: "col-sm-2 control-label" %>
<div class="col-sm-10">
Expand Down
2 changes: 1 addition & 1 deletion app/views/members/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion app/views/members/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
<dd></dd>
<% end %>

<dt>Extracurricular Activities:</dt>
<dt>Extracurricular</dt>
<dt>Activities:</dt>
<% if @member.extracurricular_activities.present? %>
<%= content_tag_for(:dd, @member.extracurricular_activities) do |extracurricular_activity| %>
<%= link_to extracurricular_activity.name, extracurricular_activity %>
Expand All @@ -101,6 +102,11 @@
<dt>Recruitment:</dt>
<dd><%= @member.recruitment %></dd>

<dt>Children in</dt>
<dd></dd>
<dt>Birmingham School:</dt>
<dd><%= @member.children_in_birmingham_school %></dd>

<dt>Community networks:</dt>
<dd><%= @member.community_networks %></dd>

Expand Down
7 changes: 6 additions & 1 deletion app/views/sign_ups/_confirm.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@

<dt>Identity:</dt>
<dd id="identity"></dd>
</dl>

<dt>Children in</dt>
<dd></dd>
<dt>Birmingham School:</dt>
<dd id="children_in_birmingham_school"></dd>
</dl>

<%= f.hidden_field :member_id %>
<%= f.hidden_field :level %>
Expand Down
20 changes: 14 additions & 6 deletions app/views/sign_ups/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@
</div>
</div>

<div id="school">
<%= render :partial => 'school', locals: { f: f} %>
</div>
<div id="graduating">
<%= render :partial => 'graduating', locals: { f: f} %>
<div id="school">
<%= render :partial => 'school', locals: { f: f} %>
</div>

<div id="graduating">
<%= render :partial => 'graduating', locals: { f: f} %>
</div>

<div id="children_in_birmingham_form" class="form-group">
<%= f.label :children_in_birmingham_school, class: "col-sm-2 control-label" %>
<div class="col-sm-10">
<%= f.check_box :children_in_birmingham_school, class: "form-control" %>
</div>

</div>

<div class="form-group">
<%= hidden_field_tag :member_id, @member_id %>
<%= hidden_field_tag :level, @level %>
Expand Down
7 changes: 4 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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|
Expand Down