route to conference#show for custom domain
This commit is contained in:
parent
1a5aa14e2c
commit
0ac5d18ef2
5 changed files with 30 additions and 6 deletions
|
|
@ -9,10 +9,17 @@ class ConferencesController < ApplicationController
|
||||||
@antiquated = @conferences - @current
|
@antiquated = @conferences - @current
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
def show
|
||||||
|
# have to change "localhost" to ENV['OSEM_HOSTNAME'] in production
|
||||||
|
check_custom_domain if request.host != 'localhost'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def check_custom_domain
|
||||||
|
@conference = @conference.custom_domain.present? ? Conference.find_by(custom_domain: request.domain) : @conference
|
||||||
|
end
|
||||||
|
|
||||||
def respond_to_options
|
def respond_to_options
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { head :ok }
|
format.html { head :ok }
|
||||||
|
|
|
||||||
6
config/initializers/domain_constraint.rb
Normal file
6
config/initializers/domain_constraint.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
class DomainConstraint
|
||||||
|
def self.matches?(request)
|
||||||
|
@domains = Conference.pluck(:custom_domain).compact
|
||||||
|
@domains.include?(request.domain)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
Osem::Application.routes.draw do
|
Osem::Application.routes.draw do
|
||||||
|
|
||||||
|
constraints DomainConstraint do
|
||||||
|
get '/', to: 'conferences#show'
|
||||||
|
end
|
||||||
|
|
||||||
if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||||
devise_for :users, controllers: { registrations: :registrations }
|
devise_for :users, controllers: { registrations: :registrations }
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddCustomDomainToConferences < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :conferences, :custom_domain, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
12
db/schema.rb
12
db/schema.rb
|
|
@ -11,10 +11,10 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20170807092805) do
|
ActiveRecord::Schema.define(version: 20170816203325) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: :cascade do |t|
|
create_table "ahoy_events", force: :cascade do |t|
|
||||||
t.integer "visit_id"
|
t.uuid "visit_id", limit: 16
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.text "properties"
|
t.text "properties"
|
||||||
|
|
@ -127,6 +127,7 @@ ActiveRecord::Schema.define(version: 20170807092805) do
|
||||||
t.integer "end_hour", default: 20
|
t.integer "end_hour", default: 20
|
||||||
t.integer "organization_id"
|
t.integer "organization_id"
|
||||||
t.integer "ticket_layout", default: 0
|
t.integer "ticket_layout", default: 0
|
||||||
|
t.string "custom_domain"
|
||||||
t.integer "booth_limit", default: 0
|
t.integer "booth_limit", default: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -511,10 +512,10 @@ ActiveRecord::Schema.define(version: 20170807092805) do
|
||||||
|
|
||||||
create_table "tickets", force: :cascade do |t|
|
create_table "tickets", force: :cascade do |t|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "price_cents", default: 0, null: false
|
t.integer "price_cents", default: 0, null: false
|
||||||
t.string "price_currency", default: "USD", null: false
|
t.string "price_currency", default: "USD", null: false
|
||||||
t.boolean "registration_ticket", default: false
|
t.boolean "registration_ticket", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -572,6 +573,7 @@ ActiveRecord::Schema.define(version: 20170807092805) do
|
||||||
t.boolean "is_admin", default: false
|
t.boolean "is_admin", default: false
|
||||||
t.string "username"
|
t.string "username"
|
||||||
t.boolean "is_disabled", default: false
|
t.boolean "is_disabled", default: false
|
||||||
|
t.string "token"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue