This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/config/routes.rb

104 lines
3.0 KiB
Ruby

PrototypeR4::Application.routes.draw do
devise_for :users
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
resources :sites
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
namespace :admin do
resources :assets
resources :items do
member do
put :up
put :down
end
end
resources :layouts
resources :links
resources :pages
resources :homes
resources :snippets
resources :translations
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 '*page_name' => 'pages#show', :as => :page, :constraints => lambda{|request|
!request.path.starts_with?("/panel")
}
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# 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'
# See how all your routes lay out with "rake routes"
# 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)))'
end