Removed slug normalization from admin routes, and added Conferences redirect.
This commit is contained in:
parent
69e8a29fc7
commit
d686e3ae72
@ -1,6 +1,8 @@
|
|||||||
class SlugConstraint
|
class SlugConstraint
|
||||||
def matches?(request)
|
def matches?(request)
|
||||||
request.params[:slug] = request.params[:slug].downcase if request.params[:slug]
|
if request.params[:slug]
|
||||||
|
request.params[:slug] = request.params[:slug].downcase
|
||||||
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,8 +4,10 @@ Sidekiq::Web.set :sessions, false
|
|||||||
BikeBike::Application.routes.draw do
|
BikeBike::Application.routes.draw do
|
||||||
|
|
||||||
# Redirect uppercase CONFERENCES to lowercase conferences
|
# Redirect uppercase CONFERENCES to lowercase conferences
|
||||||
get '/CONFERENCES(*anything)', to: redirect { |params, request| "/conferences#{params[:anything]}" }
|
get '/CONFERENCES(*anything)', to: redirect { |params| "/conferences#{params[:anything]}" }
|
||||||
get '/CONFERENCES', to: redirect('/conferences')
|
get '/CONFERENCES', to: redirect('/conferences')
|
||||||
|
get '/Conferences(*anything)', to: redirect { |params| "/conferences#{params[:anything]}" }
|
||||||
|
get '/Conferences', to: redirect('/conferences')
|
||||||
|
|
||||||
# Conferences
|
# Conferences
|
||||||
scope :conferences do
|
scope :conferences do
|
||||||
@ -14,11 +16,10 @@ BikeBike::Application.routes.draw do
|
|||||||
get 'new' => 'administration#new', as: :new_conference
|
get 'new' => 'administration#new', as: :new_conference
|
||||||
post 'save' => 'administration#save', as: :save_conference
|
post 'save' => 'administration#save', as: :save_conference
|
||||||
|
|
||||||
|
# Public routes with slug normalization
|
||||||
scope ':slug', constraints: SlugConstraint.new do
|
scope ':slug', constraints: SlugConstraint.new do
|
||||||
root 'conferences#view', as: :conference
|
root 'conferences#view', as: :conference
|
||||||
|
|
||||||
get 'edit' => 'administration#edit', as: :edit_conference
|
|
||||||
|
|
||||||
# Registration
|
# Registration
|
||||||
scope :register do
|
scope :register do
|
||||||
root 'conferences#register', as: :register, via: [:get, :post]
|
root 'conferences#register', as: :register, via: [:get, :post]
|
||||||
@ -27,18 +28,7 @@ BikeBike::Application.routes.draw do
|
|||||||
get ':step' => 'conferences#register', as: :register_step
|
get ':step' => 'conferences#register', as: :register_step
|
||||||
end
|
end
|
||||||
|
|
||||||
# Administration
|
# Survey
|
||||||
scope :administration do
|
|
||||||
root 'conference_administration#administration', as: :administrate_conference
|
|
||||||
|
|
||||||
get ':step' => 'conference_administration#administration_step', as: :administration_step
|
|
||||||
get 'stats/:conference_slug' => 'conference_administration#previous_stats', as: :previous_stats
|
|
||||||
post 'update/:step' => 'conference_administration#admin_update', as: :administration_update
|
|
||||||
get 'events/edit/:id' => 'conference_administration#edit_event', as: :edit_event
|
|
||||||
get 'locations/edit/:id' => 'conference_administration#edit_location', as: :edit_location
|
|
||||||
get 'check_in/:id' => 'conference_administration#check_in', as: :check_in, constraints: { id: /.+/ }
|
|
||||||
end
|
|
||||||
|
|
||||||
scope :survey do
|
scope :survey do
|
||||||
root 'conferences#survey', as: :conference_survey
|
root 'conferences#survey', as: :conference_survey
|
||||||
post 'save' => 'conferences#save_survey', as: :conference_survey_save
|
post 'save' => 'conferences#save_survey', as: :conference_survey_save
|
||||||
@ -75,6 +65,23 @@ BikeBike::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Admin routes (without slug normalization)
|
||||||
|
scope ':slug' do
|
||||||
|
get 'edit' => 'administration#edit', as: :edit_conference
|
||||||
|
|
||||||
|
# Administration
|
||||||
|
scope :administration do
|
||||||
|
root 'conference_administration#administration', as: :administrate_conference
|
||||||
|
|
||||||
|
get ':step' => 'conference_administration#administration_step', as: :administration_step
|
||||||
|
get 'stats/:conference_slug' => 'conference_administration#previous_stats', as: :previous_stats
|
||||||
|
post 'update/:step' => 'conference_administration#admin_update', as: :administration_update
|
||||||
|
get 'events/edit/:id' => 'conference_administration#edit_event', as: :edit_event
|
||||||
|
get 'locations/edit/:id' => 'conference_administration#edit_location', as: :edit_location
|
||||||
|
get 'check_in/:id' => 'conference_administration#check_in', as: :check_in, constraints: { id: /.+/ }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Contact
|
# Contact
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user