orbit-basic/config/routes.rb

103 lines
2.9 KiB
Ruby
Raw Normal View History

PrototypeR4::Application.routes.draw do
2010-03-08 08:04:05 +00:00
devise_for :users
2010-03-08 08:04:05 +00:00
# The priority is based upon order of creation:
# first created -> highest priority.
2009-05-07 16:53:18 +00:00
# Sample of regular route:
2010-03-08 08:04:05 +00:00
# match 'products/:id' => 'catalog#view'
2009-05-07 16:53:18 +00:00
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
2010-03-08 08:04:05 +00:00
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
2009-05-07 16:53:18 +00:00
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
2010-03-08 08:04:05 +00:00
# resources :products
resources :sites
2009-05-07 16:53:18 +00:00
# Sample resource route with options:
2010-03-08 08:04:05 +00:00
# resources :products do
# member do
# get 'short'
# post 'toggle'
2010-03-08 08:04:05 +00:00
# end
#
# collection do
# get 'sold'
2010-03-08 08:04:05 +00:00
# end
# end
2009-05-07 16:53:18 +00:00
# Sample resource route with sub-resources:
2010-03-08 08:04:05 +00:00
# resources :products do
# resources :comments, :sales
# resource :seller
# end
namespace :admin do
resources :assets
resources :items do
member do
put :up
put :down
end
2010-03-08 08:04:05 +00:00
end
resources :layouts
resources :links
resources :pages
resources :homes
resources :snippets
resources :translations
2011-02-01 07:12:23 +00:00
resources :user_info_models
resources :user_role_models
end
namespace :panel do
resources :users
end
# Patch Mongo::GridIO to contain an each method.
require File.join Rails.root, 'lib/grid_io'
Mongo::GridIO.send(:include, PrototypeR4::GridIO)
match "/gridfs/*path", :via => :get, :to => proc { |env|
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "")
begin
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
[ 200, { 'Content-Type' => gridfs_file.content_type, 'Content-Length' => gridfs_file.file_length.to_s }, gridfs_file ]
rescue
message = 'Grid file not found.'
[ 404, { 'Content-Type' => 'text/plain', 'Content-Length' => message.size.to_s }, message ]
end
}
match '/' => 'pages#index'
match '*page_name' => 'pages#show', :as => :page
2009-05-07 16:53:18 +00:00
# Sample resource route with more complex sub-resources
2010-03-08 08:04:05 +00:00
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
2010-03-08 08:04:05 +00:00
# end
2009-05-07 16:53:18 +00:00
# end
# Sample resource route within a namespace:
2010-03-08 08:04:05 +00:00
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
2009-05-07 16:53:18 +00:00
# end
2010-03-08 08:04:05 +00:00
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
root :to => 'pages#index'
2009-05-07 16:53:18 +00:00
# See how all your routes lay out with "rake routes"
2010-03-08 08:04:05 +00:00
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
2009-05-07 16:53:18 +00:00
end