changes from comments, fix commercials failing test

This commit is contained in:
Stella Rouzi 2014-08-13 22:46:41 +03:00
parent d794593e10
commit beb88b848d
15 changed files with 58 additions and 77 deletions

View file

@ -3,7 +3,7 @@ module Admin
load_and_authorize_resource :conference, find_by: :short_title
def index
if (current_user.has_role? :organizer, @conference) || (current_user.has_role? :volunteer_coordinator, @conference)
if can_manage_volunteers(@conference)
render :index
else
authorize! :index, :volunteer
@ -11,7 +11,7 @@ module Admin
end
def show
if (current_user.has_role? :organizer, @conference) || (current_user.has_role? :volunteer_coordinator, @conference)
if can_manage_volunteers(@conference)
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@ -23,12 +23,11 @@ module Admin
end
def update
if (current_user.has_role? :organizer, @conference) || (current_user.has_role? :volunteer_coordinator, @conference)
begin
@conference.update_attributes!(params[:conference])
if can_manage_volunteers(@conference)
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
rescue => e
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
else
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}")
end
else
authorize! :index, :volunteer