Sanskrit::Application.routes.draw do
	# The priority is based upon order of creation: first created -> highest priority.
	# See how all your routes lay out with "rake routes".

	root :to => 'high_voltage/pages#show', id: 'home'

	get '/legal-notice', :to => 'high_voltage/pages#show', id: 'legal-notice'

	get '/search', :to => 'search#index'

	get '/dictionary', :to => redirect('/dictionaries')
	get '/dictionaries', :to => 'dictionaries#index'
	resources :dictionary, :controller => 'dictionaries', :only => [:index, :show] do
		get '/lemma', :to => redirect { |params, req| "/dictionary/#{params[:dictionary_id]}/lemmas" }
		get '/lemmas', :to => 'lemmas#index'
		resources :lemma, :controller => 'lemmas', :only => [:index, :show]

		get '/scan', :to => redirect { |params, req| "/dictionary/#{params[:dictionary_id]}/scans" }
		get '/scans', :to => 'scans#index'
		resources :scan, :controller => 'scans', :only => [:index, :show]
	end
end

# Licensed under the ISC licence, see LICENCE.ISC for details.

Sanskrit::Application.routes.draw do
	# The priority is based upon order of creation: first created -> highest priority.
	# See how all your routes lay out with "rake routes".

	root :to => 'high_voltage/pages#show', id: 'home'

	get '/legal-notice', :to => 'high_voltage/pages#show', id: 'legal-notice'

	get '/search', :to => 'search#index'

	get '/dictionary', :to => redirect('dictionaries/')
	get '/dictionaries/', :to => 'dictionaries#index', :trailing_slash => true
	resources :dictionary, :controller => 'dictionaries', :only => [:index, :show] do
		get '/lemma', :to => redirect { |params, req| "dictionary/#{params[:dictionary_id]}/lemmas" }
		get '/lemmas', :to => 'lemmas#index'
		resources :lemma, :controller => 'lemmas', :only => [:index, :show]

		get '/scan', :to => redirect { |params, req| "dictionary/#{params[:dictionary_id]}/scans" }
		get '/scans', :to => 'scans#index'
		resources :scan, :controller => 'scans', :only => [:index, :show]
	end
end

# Licensed under the ISC licence, see LICENCE.ISC for details.

Make redirects robust enough to cope with a relative root URL
Make redirects robust enough to cope with a relative root URL
