osem-fcy/app/controllers/admin/volunteers_controller.rb

26 lines
950 B
Ruby
Raw Normal View History

class Admin::VolunteersController < ApplicationController
def index
@conference = Conference.find_by(short_title: params[:conference_id])
render :index
end
def show
@conference = Conference.find_by(short_title: params[:conference_id])
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
2014-07-21 14:49:05 +02:00
@volunteers = @conference.registrations.where(volunteer: true)
end
end
def update
@conference = Conference.find_by(short_title: params[:conference_id])
begin
@conference.update_attributes!(params[:conference])
2014-07-21 14:49:05 +02:00
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
2014-07-21 14:37:26 +02:00
rescue => e
2014-07-21 14:49:05 +02:00
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
end
end
end