Module: Comatose::Routes
- Defined in:
- lib/comatose/routes.rb,
lib/comatose/locale_constraint.rb
Defined Under Namespace
Classes: LocaleConstraint
Instance Method Summary collapse
- #admin_routes_for_comatose(opts = {}, &block) ⇒ Object
- #routes_for_comatose(opts = {}, &block) ⇒ Object
Instance Method Details
#admin_routes_for_comatose(opts = {}, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/comatose/routes.rb', line 28 def admin_routes_for_comatose(opts={}, &block) Comatose.logger.debug("routes_for_comatose options: #{opts}") case when opts.empty? namespace(:comatose, :path => "/:locale/comatose") do constraints(LocaleConstraint) do match '', :to => 'admin#index' resources :pages, :controller => 'admin' do collection do post :import get :export, :expire end member do get :versions, :reorder post :preview end end end end when opts[:mount] namespace(:comatose, :path => "/:locale/comatose") do # defaults :index => opts[:mount] do constraints(LocaleConstraint) do match '', :to => 'admin#index' resources :pages, :controller => 'admin' do collection do post :import get :export, :expire end member do get :preview, :versions, :reorder end end end #end end end end |
#routes_for_comatose(opts = {}, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/comatose/routes.rb', line 6 def routes_for_comatose(opts={}, &block) Comatose.logger.debug("routes_for_comatose options: #{opts}") case when opts.empty? scope :module => "comatose" do constraints(LocaleConstraint) do match '/:locale/:page', :to => 'base#show' match '/:locale', :to => 'base#show', :as => 'comatose_root' end end when opts[:mount] scope :module => "comatose" do constraints(LocaleConstraint) do match "/:locale/#{opts[:mount]}/:page", :to => 'base#show', :index => opts[:mount] match "/:locale/#{opts[:mount]}", :to => 'base#show', :index => opts[:mount], :as => "#{opts[:mount].underscore}_comatose_root" end end Comatose.add_mount_point(opts[:mount], { :index => opts[:index] || '' }) end end |