Sha256: 9fad32f24c61f47d67e734b3dcd65aada63f0798ddbee88daf3cf44648e88c0e

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

Rails.application.routes.append do

  routes_block = lambda do

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

    get "/" => redirect(dashboard)
    get "dashboard" => "dashboard#index", :as => "dashboard_index"
    get "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

    Typus.models.map(&:to_resource).each do |_resource|
      get "#{_resource}(/:action(/:id))(.:format)", :controller => _resource
      post "#{_resource}(/:action(/:id))(.:format)", :controller => _resource
      patch "#{_resource}(/:action(/:id))(.:format)", :controller => _resource
      delete "#{_resource}(/:action(/:id))(.:format)", :controller => _resource
    end

    Typus.resources.map(&:underscore).each do |_resource|
      get "#{_resource}(/:action(/:id))(.:format)", :controller => _resource
      post "#{_resource}(/:action(/:id))(.:format)", :controller => _resource
    end

  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

1 entries across 1 versions & 1 rubygems

Version Path
brainsome_typus-4.0.0.beta3 config/routes.rb