Skip to content
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/tmp

# Ignore byebug history files
.byebug_history
.byebug_history

# Ignore IDE
/.idea
16 changes: 11 additions & 5 deletions app/assets/javascripts/sign_ups.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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', ->
Expand All @@ -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()
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 @@ -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
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_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
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 @@ -185,6 +185,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_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
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_id"></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 @@ -67,13 +67,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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddChildrenInSchoolToMembers < ActiveRecord::Migration
def change
add_column :members, :children_in_school, :boolean
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class FixChildrenInBirminghamSchoolName < ActiveRecord::Migration
def change
rename_column :members, :children_in_school, :children_in_birmingham_school
end
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down