Merge d2b5ec1770 into 83abc9f71f
This commit is contained in:
commit
304339f9fc
15 changed files with 240 additions and 7 deletions
|
|
@ -4,6 +4,23 @@ module Admin
|
|||
load_resource :program, through: :conference, singleton: true, except: :index
|
||||
load_resource :user, only: [:remove_user]
|
||||
|
||||
def custom_domain
|
||||
redirect_to attach_custom_domain_admin_conference_path(@conference.short_title) unless @conference.custom_domain.present?
|
||||
end
|
||||
|
||||
def attach_custom_domain; end
|
||||
|
||||
def update_domain
|
||||
@conference.assign_attributes(conference_params)
|
||||
if @conference.save
|
||||
redirect_to custom_domain_admin_conference_path(id: @conference.short_title),
|
||||
notice: 'Added new domain name to conference. This does not mean that the new domain should work. Please make sure you follow step 2 to point your domain to this hosted version'
|
||||
else
|
||||
redirect_to custom_domain_admin_conference_path(id: @conference.short_title),
|
||||
notice: 'Failed to add the new domain as custom domain to the conference'
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
# Redirect to new form if there is no conference
|
||||
if Conference.count == 0
|
||||
|
|
@ -211,7 +228,7 @@ module Admin
|
|||
:vpositions_attributes, :use_volunteers, :color,
|
||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||
:targets, :targets_attributes,
|
||||
:campaigns, :campaigns_attributes, :registration_limit, :organization_id, :ticket_layout)
|
||||
:campaigns, :campaigns_attributes, :registration_limit, :organization_id, :ticket_layout, :custom_domain)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue