Merge branch 'master' into rebased_1530

This commit is contained in:
Shlok Srivastava 2017-08-23 18:58:02 +00:00 • committed by GitHub
commit aebdd66034
12 changed files with 90 additions and 24 deletions

View file

@ -90,6 +90,10 @@ module Admin
update_state(:cancel, 'Booth is canceled')
end
def confirm
update_state(:confirm, 'Booth successfully confirmed')
end
private
def update_state(transition, notice)

View file

@ -1,18 +1,29 @@
class ConferencesController < ApplicationController
protect_from_forgery with: :null_session
before_action :respond_to_options
load_and_authorize_resource find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index
load_and_authorize_resource find_by: :short_title, except: :show
def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
@antiquated = @conferences - @current
end
def show; end
def show
@conference = if params[:id]
Conference.find_by_short_title(params[:id])
else
load_conference_by_domain
end
authorize! :show, @conference
@program = @conference.program
end
private
def load_conference_by_domain
Conference.find_by(custom_domain: request.domain)
end
def respond_to_options
respond_to do |format|
format.html { head :ok }