Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lilliealbert/bridge_troll
Browse files Browse the repository at this point in the history
…into lilliealbert-master
  • Loading branch information
tjgrathwell committed Mar 18, 2013
2 parents 376e684 + c280919 commit 02201bb
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 58 deletions.
9 changes: 9 additions & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def volunteer_emails
end

def organize
@volunteer_rsvps = @event.volunteer_rsvps
@volunteer_counts = {
VolunteerAssignment::UNASSIGNED => 0,
VolunteerAssignment::TEACHER => 0,
VolunteerAssignment::TA => 0,
}
@volunteer_rsvps.each do |rsvp|
@volunteer_counts[rsvp.volunteer_assignment_id] += 1
end
end

protected
Expand Down
34 changes: 18 additions & 16 deletions app/views/events/organize.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
] %>

<h2>Volunteer Teaching Preference Totals</h2>
<p>You can assign people's roles on the Manage Volunteers page.</p>
<p>You can see individual preferences and assign teaching roles on the <%= link_to('Manage Volunteers', event_volunteers_path(@event)) %> page.</p>
<table class="table">
<thead>
<tr>
Expand All @@ -43,21 +43,23 @@
</tbody>
</table>

<div>
<h4>Willing to Teach: <%= teachers_count(@event.volunteer_rsvps) %></h4>
<%= partitioned_volunteer_list(@event.volunteer_rsvps, :teachers) %>

<h4>Willing to TA: <%= tas_count(@event.volunteer_rsvps) %></h4>
<%= partitioned_volunteer_list(@event.volunteer_rsvps, :tas) %>

<h4>Willing to Teach or TA: <%= teach_or_ta_count(@event.volunteer_rsvps) %></h4>
<%= partitioned_volunteer_list(@event.volunteer_rsvps, :teach_or_tas) %>

<h4>Not Interested in Teaching: <%= not_teach_or_ta_count(@event.volunteer_rsvps) %></h4>
<%= partitioned_volunteer_list(@event.volunteer_rsvps, :not_teach_or_tas) %>

<h4>All Volunteers: <%= @event.volunteer_rsvps.length %></h4>
</div>
<h2>Volunteer Assignment Totals</h2>
<table class="table">
<thead>
<tr>
<th>Unassigned</th>
<th>Teachers</th>
<th>TAs</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @volunteer_counts[VolunteerAssignment::UNASSIGNED] %></td>
<td><%= @volunteer_counts[VolunteerAssignment::TEACHER] %></td>
<td><%= @volunteer_counts[VolunteerAssignment::TA] %></td>
</tr>
</tbody>
</table>

<%= render 'shared/actions', links: [
['Back', events_path],
Expand Down
6 changes: 1 addition & 5 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<div class="row-fluid has-giant-header">
<div class="span7">
<h1><%= @event.title %></h1>
</div>
</div>
<%= render 'header' %>

<div class="row-fluid">
<div class="span8">
Expand Down
1 change: 0 additions & 1 deletion app/views/events/volunteer_emails.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<table>
<% @volunteers.each do |volunteer| %>
<tr>
<td><%= volunteer.first_name %> <%= volunteer.last_name %>: </td>
<td><%= volunteer.email %></td>
</tr>
<% end %>
Expand Down
5 changes: 3 additions & 2 deletions app/views/rsvps/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
</div>

<div class="field">
<%= f.label :teaching_experience, "Teaching Experience" %>
<%= f.label :teaching_experience, "What's your experience with teaching?" %>
<%= f.text_area :teaching_experience, rows: 5, cols: 80,
maxlength: Rsvp::MAX_EXPERIENCE_LENGTH %>
</div>

<strong>Teaching preference?</strong>
<p>If you're happy to do either, leave this section blank.</p>
<div class="field">
<%= f.label :teaching, class: 'checkbox' do %>
<%= f.check_box :teaching %> Teaching
<% end %>
<%= f.label :taing, class: 'checkbox' do %>
<%= f.check_box :taing %> Taing
<%= f.check_box :taing %> TAing
<% end %>
</div>

Expand Down
4 changes: 3 additions & 1 deletion app/views/rsvps/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<h1> Edit RSVP </h1>
<%= render 'events/header' %>

<h2> Edit RSVP </h2>

<%= render 'form' %>
4 changes: 3 additions & 1 deletion app/views/rsvps/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<h1>RSVP</h1>
<%= render 'events/header' %>

<h2>RSVP</h2>

<%= render 'form' %>
Expand Down
10 changes: 5 additions & 5 deletions app/views/volunteers/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<%= render 'events/header' %>

<h3>Volunteer Assignments</h3>
<h4>Event: <%= link_to " #{@event.title}", event_path(@event)%></h4>
<h4>
<%= "When: #{formatted_session_datetime(@event.event_sessions.first)}" %>
</h4>
<h2>Assign Volunteer Teaching Roles</h2>

<div id="saving_indicator"></div>

<table class='table table-striped table-bordered table-condensed'>
<th>Name</th>
<th>Subject Experience</th>
<th>Teaching Experience</th>
<th>Volunteer's Preference</th>
<th>Assignment</th>
<% @volunteer_rsvps.each do |rsvp| %>
<tr>
<td><%= rsvp.user.full_name %></td>
<td><%= rsvp.subject_experience %></td>
<td><%= rsvp.teaching_experience %></td>
<td><%= rsvp.formatted_preference %></td>
<td>
<%= form_for([@event, rsvp], method: :put, url: event_volunteer_path(@event, rsvp.id), remote: true) do %>
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/event_listing_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
it "allows user to edit volunteer responsibilities" do
click_link("Edit RSVP")
uncheck 'Teaching'
check 'Taing'
check 'TAing'

uncheck "Installfest"
check "Curriculum"
Expand Down
26 changes: 0 additions & 26 deletions spec/requests/event_organizer_dashboard_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,6 @@
page.should have_content("Volunteer Assignment")
end

it "shows all volunteer information" do
4.times { create(:rsvp, event: @event, teaching: true) }
3.times { create(:rsvp, event: @event, taing: true) }
2.times { create(:rsvp, event: @event, teaching: true, taing: true) }
1.times { create(:rsvp, event: @event) }

volunteer = create(:user)
create(:rsvp, user: volunteer, event: @event, teaching: true)

visit organize_event_path(@event)
page.should have_content(volunteer.email)
page.should have_content(volunteer.full_name)
page.should have_content("#{volunteer.full_name} - #{volunteer.email}")

page.should have_content("Willing to Teach: 5")
page.should have_content("Willing to TA: 3")
page.should have_content("Willing to Teach or TA: 2")
page.should have_content("Not Interested in Teaching: 1")
page.should have_content("All Volunteers: 11")

page.should have_css('.teach', count: 5)
page.should have_css('.ta', count: 3)
page.should have_css('.both', count: 2)
page.should have_css('.none', count: 1)
end

it "lets the user check in volunteers", js: true do
user1 = create(:user, first_name: 'Anthony')
user2 = create(:user, first_name: 'Bapp')
Expand Down

0 comments on commit 02201bb

Please sign in to comment.