fix registration page, only show volunteering tab if option is enabled for the conference

This commit is contained in:
Stella 2014-03-04 22:22:52 +02:00
parent 04e06ac251
commit 8f8824ecd6
7 changed files with 69 additions and 72 deletions

View file

@ -6,16 +6,20 @@ class Admin::VolunteersController < ApplicationController
def show
@conference = Conference.find_all_by_short_title(params[:conference_id]).first
@volunteers = @conference.registrations.joins(:vchoices).all
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@volunteers = @conference.registrations.where(:volunteer => true)
end
end
def update
@conference = Conference.find_all_by_short_title(params[:conference_id]).first
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteer_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
rescue Exception => e
redirect_to(admin_conference_volunteer_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
end
end
end