2014-01-01 11:39:59 +02:00
|
|
|
class Admin::VolunteersController < ApplicationController
|
|
|
|
|
def index
|
2014-04-27 16:27:29 +02:00
|
|
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
2014-01-01 11:39:59 +02:00
|
|
|
render :index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def show
|
2014-04-27 16:27:29 +02:00
|
|
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
2014-03-04 22:22:52 +02:00
|
|
|
if @conference.use_vpositions
|
|
|
|
|
@volunteers = @conference.registrations.joins(:vchoices).uniq
|
|
|
|
|
else
|
|
|
|
|
@volunteers = @conference.registrations.where(:volunteer => true)
|
|
|
|
|
end
|
2014-01-01 11:39:59 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update
|
2014-04-27 16:27:29 +02:00
|
|
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
2014-03-04 10:30:23 +01:00
|
|
|
begin
|
2014-01-01 11:39:59 +02:00
|
|
|
@conference.update_attributes!(params[:conference])
|
2014-03-04 22:22:52 +02:00
|
|
|
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
|
2014-03-04 10:30:23 +01:00
|
|
|
rescue Exception => e
|
2014-03-04 22:22:52 +02:00
|
|
|
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
|
2014-01-01 11:39:59 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|