Skip to content

Commit

Permalink
Organizery actions have been moved from Edit Event to an Organizer Da…
Browse files Browse the repository at this point in the history
…shboard
  • Loading branch information
lilliealbert authored and tjgrathwell committed Mar 17, 2013
1 parent 5168d1e commit 21dc58a
Show file tree
Hide file tree
Showing 18 changed files with 260 additions and 231 deletions.
8 changes: 6 additions & 2 deletions app/assets/stylesheets/_base.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ table tr td .btn {
}

.bridgetroll-content {
width: 1000px;
width: 900px;
margin-left: auto;
margin-right: auto;
background-color: $content-background-color;
Expand Down Expand Up @@ -117,8 +117,13 @@ table tr td .btn {
margin: 20px 0 0 0;
list-style-type: none;

&.mission-control-actions {
margin: 0 0 20px 0;
}

li {
display: inline-block;
margin: 10px 10px 0 0;
}
}

Expand Down Expand Up @@ -181,7 +186,6 @@ table tr td .btn {
border-radius: 10px;
}


// BOOTSTRAP OVERRIDES, Yo. Frowny buckets.

.container::before,
Expand Down
9 changes: 6 additions & 3 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class EventsController < ApplicationController
before_filter :authenticate_user!, only: [:new, :edit, :create, :update, :destroy]
before_filter :find_event, only: [:show, :edit, :update, :destroy, :volunteer_emails]
before_filter :require_organizer, only: [:edit, :update, :destroy, :volunteer_emails]
before_filter :authenticate_user!, except: [:index, :show]
before_filter :find_event, only: [:show, :edit, :update, :destroy, :volunteer_emails, :organize]
before_filter :require_organizer, only: [:edit, :update, :destroy, :volunteer_emails, :organize]
before_filter :assign_organizer, only: [:show, :edit, :update, :destroy]
before_filter :set_time_zone, only: [:create, :update]

Expand Down Expand Up @@ -49,6 +49,9 @@ def volunteer_emails
@volunteers = @event.volunteers
end

def organize
end

protected

def set_time_zone
Expand Down
6 changes: 4 additions & 2 deletions app/views/checkins/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<h1>Check in volunteers to <%= @session.name %></h1>
<%= render 'events/header' %>

<h2>Check in volunteers to <%= @session.name %></h2>

<table class="table table-striped table-bordered table-condensed">
<tr>
Expand All @@ -23,5 +25,5 @@
</table>

<%= render 'shared/actions', links: [
['Back', event_path(@event)],
['Back', organize_event_path(@event)],
] %>
5 changes: 5 additions & 0 deletions app/views/events/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="row-fluid has-giant-header">
<div class="span7">
<h1><%= @event.title %></h1>
</div>
</div>
7 changes: 3 additions & 4 deletions app/views/events/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<%= render 'events/header' %>

<h1>Editing event</h1>

<%= render 'form' %>
<%= render 'shared/actions', links: [
['Show', @event],
['Back', events_path],
['Back', @event],
['Manage Locations', locations_path],
['Manage Organizers', event_organizers_path(@event)],
['Manage Volunteers', event_volunteers_path(@event)]
] %>

2 changes: 1 addition & 1 deletion app/views/events/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<% if user_signed_in? %>
<% if event.organizer?(current_user) %>
<td>
You are the Organizer for this event!
<%= link_to 'Organizer Console', organize_event_path(event), :class => 'btn' %>
</td>
<% elsif event.volunteer?(current_user) %>
<td>
Expand Down
7 changes: 5 additions & 2 deletions app/views/events/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<h1>New event</h1>

<div class="row-fluid has-giant-header">
<div class="span7">
<h1>Organize an Event</h1>
</div>
</div>
<%= render 'form' %>
<%= render 'shared/actions', links: [
Expand Down
64 changes: 64 additions & 0 deletions app/views/events/organize.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<%= render 'header' %>

<h2>Super Secret Organizer Mission Control Console</h2>

<% checkin_links = [] %>
<% @event.event_sessions.each do |session| %>
<% checkin_links << ["Check in for #{session.name}", event_event_session_checkins_path(@event, session)] %>
<% end %>
<%= render 'shared/actions', links: checkin_links, additional_class: 'mission-control-actions' %>
<%= render 'shared/actions', additional_class: 'mission-control-actions', links: [
['Manage Organizers', event_organizers_path(@event)],
['Manage Volunteers', event_volunteers_path(@event)],
['Email Volunteers', volunteer_emails_event_path(@event)]
] %>
<%= render 'shared/actions', additional_class: 'mission-control-actions', links: [
['Edit Event', edit_event_path(@event)],
['View Event', event_path(@event)],
] %>

<h2>Volunteer Teaching Preference Totals</h2>
<p>You can assign people's roles on the Manage Volunteers page.</p>
<table class="table">
<thead>
<tr>
<th>Wants to teach</th>
<th>Wants to TA</th>
<th>No preference</th>
<th>Non-teaching volunteer</th>
<th>Total volunteers</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= teachers_count(@event.volunteer_rsvps) %></td>
<td><%= tas_count(@event.volunteer_rsvps) %></td>
<td><%= teach_or_ta_count(@event.volunteer_rsvps) %></td>
<td><%= not_teach_or_ta_count(@event.volunteer_rsvps) %></td>
<td><%= @event.volunteer_rsvps.length %></td>
</tr>
</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>

<%= render 'shared/actions', links: [
['Back', events_path],
] %>
84 changes: 24 additions & 60 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class='session-display'>
<% @event.event_sessions.each do |event_session| %>
<div class='event-session'>
<div class='name'><%= event_session.name %></div>
<h2 class='name'><%= event_session.name %></h2>
<div class='date'><%= formatted_session_date(event_session) %></div>
<div class='time'>Start time: <%= formatted_session_time(event_session, :starts_at) %></div>
<div class='time'>End time: <%= formatted_session_time(event_session, :ends_at) %></div>
Expand All @@ -27,74 +27,18 @@
</div>

<div class="details">
<strong>Details:</strong>
<br/>
<%= simple_format_with_html(@event.details) %>
</div>

<h3>Volunteers:</h3>
<% if @event.volunteer_rsvps.none? %>
No volunteers are currently signed up for this event.
<% else %>
<% if @organizer %>
<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>
<% end %>

<table class="table">
<thead>
<tr>
<th>Name</th>
<% if @organizer %>
<th>Email</th>
<% end %>
<th>Skills</th>
</tr>
</thead>
<tbody>
<% @event.volunteer_rsvps.each do |rsvp| %>
<tr>
<td><%= link_to rsvp.user.full_name, rsvp.user.profile_path %></td>
<% if @organizer %>
<td><%= rsvp.user.email %></td>
<% end %>
<td><%= get_volunteer_skills(rsvp) %></td>
</tr>
<% end %>
</tbody>
</table>

<% end %>
<% links = [] %>
<% if @organizer %>
<% @event.event_sessions.each do |session| %>
<% links << ["Check in for #{session.name}", event_event_session_checkins_path(@event, session)] %>
<% end %>
<% links << ['Edit', edit_event_path(@event)] %>
<% links << ['Organizer Console', organize_event_path(@event)] %>
<% end %>
<% links << ['Back', events_path] %>
<% if @organizer %>
<% links << ['Manage Organizers', event_organizers_path(@event)] %>
<% links << ['Manage Volunteers', event_volunteers_path(@event)] %>
<% links << ['Email Volunteers', volunteer_emails_event_path(@event)] %>
<% end %>
<%= render 'shared/actions', links: links %>

</div>
Expand All @@ -107,7 +51,7 @@
</div>

<div class="organizers">
<h3><%= organizer_title %></h3>
<h3>Organized By:</h3>
<ul>
<% if organizer_list.any? %>
<% organizer_list.each do |organizer| %>
Expand All @@ -123,6 +67,26 @@
</p>
<% end %>
</div>

<h3>Who's volunteering?</h3>
<% if @event.volunteer_rsvps.none? %>
No volunteers are currently signed up for this event.
<% else %>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Skills</th>
</tr>
</thead>
<tbody>
<% @event.volunteer_rsvps.each do |rsvp| %>
<tr>
<td><%= link_to rsvp.user.full_name, rsvp.user.profile_path %></td>
<td><%= get_volunteer_skills(rsvp) %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>
10 changes: 9 additions & 1 deletion app/views/events/volunteer_emails.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<h2>Volunteer Emails for <%= @event.title %></h2>
<%= render 'events/header' %>

<h2>Volunteer Emails</h2>

<p>Copy these addresses into your email to contact the volunteers.</p>

<p>It's probably a good practice to BCC everyone for privacy's sake (and avoiding terrible reply-all fests).</p>

<table>
<% @volunteers.each do |volunteer| %>
<tr>
Expand All @@ -10,3 +14,7 @@
</tr>
<% end %>
</table>

<%= render 'shared/actions', links: [
['Back', organize_event_path(@event)]
] %>
4 changes: 3 additions & 1 deletion app/views/organizers/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%= render 'events/header' %>

<h3>Organizer Assignments</h3>
<br />
<h4>Event: <%= link_to " #{@event.title}", event_path(@event)%></h4>
Expand Down Expand Up @@ -41,5 +43,5 @@
</table>

<%= render 'shared/actions', links: [
['Back', event_path(@event)]
['Back', organize_event_path(@event)]
] %>
2 changes: 1 addition & 1 deletion app/views/shared/_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ul class='actions'>
<ul class='actions <% if local_assigns[:additional_class] %><%= additional_class %><% end %>'>
<% links.each do |link_data| %>
<% next unless link_data %>
<li><%= link_to link_data[0], link_data[1], class: 'btn' %></li>
Expand Down
4 changes: 3 additions & 1 deletion app/views/volunteers/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%= render 'events/header' %>

<h3>Volunteer Assignments</h3>
<h4>Event: <%= link_to " #{@event.title}", event_path(@event)%></h4>
<h4>
Expand Down Expand Up @@ -32,6 +34,6 @@
</table>

<%= render 'shared/actions', links: [
['Back', event_path(@event)]
['Back', organize_event_path(@event)]
] %>

2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
resources :event_sessions, :only => [] do
resources :checkins, :only => [:index, :create, :destroy]
end

get "volunteer_emails" => "events#volunteer_emails", :on => :member
get "organize", :on => :member
end

get "/auth/:provider/callback" => "omniauths#callback"
Expand Down
21 changes: 21 additions & 0 deletions spec/controllers/events_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,27 @@ def make_request(params = {})
end
end

describe "GET organize" do
def make_request(params = {})
get :organize, id: @event.id
end

it_behaves_like "an event action that requires an organizer"

context "organizer is logged in" do
before do
user = create(:user)
@event.organizers << user
sign_in user
end

it "should be successful" do
make_request
response.should be_success
end
end
end

describe "PUT update" do
def make_request(params = {})
put :update, id: @event.id, event: params
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 @@ -71,7 +71,7 @@

page.should have_content("February Event")
page.should have_content("AKST") # alaska time code!
page.should have_content("You are the Organizer for this event!")
page.should have_content("Organizer Console")
end

context 'given an event' do
Expand Down
Loading

0 comments on commit 21dc58a

Please sign in to comment.