2016-09-14 22:42:04 -04:00
|
|
|
class ConferencesController < ApplicationController
|
2016-03-09 14:12:31 +01:00
|
|
|
protect_from_forgery with: :null_session
|
2016-09-14 22:42:04 -04:00
|
|
|
before_action :respond_to_options
|
2017-08-02 20:16:50 +05:30
|
|
|
load_and_authorize_resource find_by: :short_title, except: :show
|
2014-08-12 11:51:59 +03:00
|
|
|
|
2014-11-14 17:24:24 +01:00
|
|
|
def index
|
2016-06-23 12:24:58 +03:00
|
|
|
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
|
2014-11-14 17:24:24 +01:00
|
|
|
@antiquated = @conferences - @current
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-22 12:34:48 +05:30
|
|
|
def show
|
2017-11-17 19:34:26 -08:00
|
|
|
@conference = Conference.unscoped.eager_load(
|
|
|
|
|
:organization,
|
|
|
|
|
:splashpage,
|
|
|
|
|
:venue,
|
|
|
|
|
:registration_period,
|
|
|
|
|
:tickets,
|
|
|
|
|
:confirmed_tracks,
|
|
|
|
|
:call_for_events,
|
|
|
|
|
:event_types,
|
|
|
|
|
:program,
|
|
|
|
|
:call_for_tracks,
|
|
|
|
|
:lodgings,
|
|
|
|
|
:call_for_booths,
|
|
|
|
|
:confirmed_booths,
|
|
|
|
|
:sponsors,
|
|
|
|
|
:call_for_sponsors,
|
|
|
|
|
:contact,
|
|
|
|
|
highlighted_events: [:speakers],
|
|
|
|
|
sponsorship_levels: [:sponsors]
|
|
|
|
|
).order(
|
|
|
|
|
'sponsorship_levels.position ASC',
|
|
|
|
|
'sponsors.name',
|
|
|
|
|
'tracks.name',
|
|
|
|
|
'booths.title',
|
|
|
|
|
'lodgings.name',
|
|
|
|
|
'tickets.price_cents'
|
|
|
|
|
).find_by(conference_finder_conditions)
|
2017-08-02 20:16:50 +05:30
|
|
|
authorize! :show, @conference
|
2017-07-22 12:34:48 +05:30
|
|
|
end
|
2014-06-30 19:24:26 +05:30
|
|
|
|
2014-11-14 17:24:24 +01:00
|
|
|
private
|
|
|
|
|
|
2017-11-17 19:34:26 -08:00
|
|
|
def conference_finder_conditions
|
|
|
|
|
if params[:id]
|
|
|
|
|
{ short_title: params[:id] }
|
|
|
|
|
else
|
|
|
|
|
{ custom_domain: request.domain }
|
|
|
|
|
end
|
2017-07-22 12:34:48 +05:30
|
|
|
end
|
|
|
|
|
|
2015-10-28 18:05:15 +02:00
|
|
|
def respond_to_options
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html { head :ok }
|
|
|
|
|
end if request.options?
|
|
|
|
|
end
|
2014-05-19 21:21:06 +05:30
|
|
|
end
|