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-12-21 19:06:36 -08:00
|
|
|
# load conference with header content
|
2017-11-17 19:34:26 -08:00
|
|
|
@conference = Conference.unscoped.eager_load(
|
|
|
|
|
:splashpage,
|
|
|
|
|
:program,
|
2017-12-21 19:06:36 -08:00
|
|
|
:registration_period,
|
2017-11-17 19:34:26 -08:00
|
|
|
:contact,
|
2017-12-21 19:06:36 -08:00
|
|
|
venue: :commercial
|
2017-11-17 19:34:26 -08:00
|
|
|
).find_by(conference_finder_conditions)
|
2017-12-21 19:06:36 -08:00
|
|
|
authorize! :show, @conference # TODO: reduce the 10 queries performed here
|
|
|
|
|
|
|
|
|
|
splashpage = @conference.splashpage
|
2018-01-15 22:23:38 -06:00
|
|
|
|
|
|
|
|
unless splashpage.present?
|
2018-01-16 19:38:22 -06:00
|
|
|
redirect_to admin_conference_splashpage_path(@conference.short_title) && return
|
2018-01-15 22:23:38 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if splashpage.include_cfp
|
|
|
|
|
cfps = @conference.program.cfps
|
|
|
|
|
@call_for_events = cfps.find { |call| call.cfp_type == 'events' }
|
|
|
|
|
if @call_for_events.try(:open?)
|
|
|
|
|
@event_types = @conference.event_types.pluck(:title)
|
|
|
|
|
@track_names = @conference.confirmed_tracks.pluck(:name).sort
|
2018-01-13 22:40:42 -06:00
|
|
|
end
|
2018-01-15 22:23:38 -06:00
|
|
|
@call_for_tracks = cfps.find { |call| call.cfp_type == 'tracks' }
|
2018-03-17 18:05:06 +02:00
|
|
|
@call_for_booths = cfps.find { |call| call.cfp_type == 'booths' }
|
2018-01-15 22:23:38 -06:00
|
|
|
end
|
|
|
|
|
if splashpage.include_program
|
|
|
|
|
@highlights = @conference.highlighted_events.eager_load(:speakers)
|
|
|
|
|
if splashpage.include_tracks
|
|
|
|
|
@tracks = @conference.confirmed_tracks.eager_load(
|
|
|
|
|
:room
|
|
|
|
|
).order('tracks.name')
|
2018-01-13 22:40:42 -06:00
|
|
|
end
|
2018-01-15 22:23:38 -06:00
|
|
|
if splashpage.include_booths
|
|
|
|
|
@booths = @conference.confirmed_booths.order('title')
|
2017-12-21 19:06:36 -08:00
|
|
|
end
|
|
|
|
|
end
|
2018-01-15 22:23:38 -06:00
|
|
|
if splashpage.include_registrations || splashpage.include_tickets
|
|
|
|
|
@tickets = @conference.tickets.order('price_cents')
|
|
|
|
|
end
|
|
|
|
|
if splashpage.include_lodgings
|
|
|
|
|
@lodgings = @conference.lodgings.order('name')
|
|
|
|
|
end
|
|
|
|
|
if splashpage.include_sponsors
|
|
|
|
|
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
|
|
|
|
|
:sponsors
|
|
|
|
|
).order('sponsorship_levels.position ASC', 'sponsors.name')
|
2018-01-17 17:03:23 -08:00
|
|
|
@sponsors = @conference.sponsors
|
2018-01-15 22:23:38 -06:00
|
|
|
end
|
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
|