Sha256: 93ad9afcd347ed9be8f85c791c2f77b3415e6af1f4ce1ccfcde8303521b3864e

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

Rails.application.routes.draw do

  routes_block = lambda do

    dashboard = Typus.subdomain ? "/dashboard" : "/admin/dashboard"

    match "/" => redirect(dashboard)
    match "dashboard" => "dashboard#index", :as => "dashboard_index"
    match "dashboard/:application" => "dashboard#show", :as => "dashboard"

    if Typus.authentication == :session
      resource :session, :only => [:new, :create], :controller => :session do
        delete :destroy, :as => "destroy"
      end

      resources :account, :only => [:new, :create, :show] do
        collection do
          get :forgot_password
          post :send_password
        end
      end
    end

    controllers = Typus.models.map(&:to_resource) + Typus.resources.map(&:underscore)
    controllers.each { |c| match "#{c}(/:action(/:id))(.:format)", :controller => c }

  end

  if Typus.subdomain
    constraints :subdomain => Typus.subdomain do
      namespace :admin, :path => "", &routes_block
    end
  else
    scope "admin", {:module => :admin, :as => "admin"}, &routes_block
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typus-3.1.10 config/routes.rb
typus-3.1.9 config/routes.rb