Sha256: a2840bb83a9d8fa676d7b81dae82b9cb2a9a7284059d31890576874ce5539ffe

Contents?: true

Size: 937 Bytes

Versions: 19

Compression:

Stored size: 937 Bytes

Contents

Rails.application.routes.draw do
  class RedirectConstraint
    def initialize; end
    def matches?(request)
      return false if request.subdomain == 'admin'
      site = Site.where(:domain => request.host).first
      site && site.redirects.where(:source_url => request.path).first
    end
  end

  constraints(RedirectConstraint.new) do
    get ':source_url', :to => 'redirects#show'
  end

  scope :constraints => lambda{ |r| ! r.path.include?('admin') && Site.exists?(:conditions => {:domain => r.host}) } do
    root :to => 'pages#show', :via => 'get'
    get '*path' => 'pages#show'
  end

  namespace :admin do
    put 'sites/:site_id/nav_items/reorder', :to => 'nav_items#reorder', :as => 'site_reorder_nav_items'
    resources :sites do
      resources :nav_items
      resources :pages do
        get 'preview', :to => 'pages#preview', :as => 'preview_admin_site_page'
      end
      resources :redirects
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
site_logic-1.9.13 config/routes.rb
site_logic-1.9.12 config/routes.rb
site_logic-1.9.11 config/routes.rb
site_logic-1.9.10 config/routes.rb
site_logic-1.9.9 config/routes.rb
site_logic-1.9.8 config/routes.rb
site_logic-1.9.7 config/routes.rb
site_logic-1.9.6 config/routes.rb
site_logic-1.9.5 config/routes.rb
site_logic-1.9.4 config/routes.rb
site_logic-1.9.3 config/routes.rb
site_logic-1.9.2 config/routes.rb
site_logic-1.9.1 config/routes.rb
site_logic-1.9.0 config/routes.rb
site_logic-1.8.0 config/routes.rb
site_logic-1.7.1 config/routes.rb
site_logic-1.7.0 config/routes.rb
site_logic-1.6.10 config/routes.rb
site_logic-1.6.9 config/routes.rb