Merge server and rails_3_1

This commit is contained in:
chris2tof committed 2011-08-18 13:43:33 +08:00
1 parent d2c2e174ac
commit 86443661e9
42 files changed
+274 -190

No files matched your search

+5 -2
View File
@@ -24,8 +24,11 @@ module PrototypeR4
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths = %W(#{config.root}/lib)
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += %W( #{config.root}/app/models/ckeditor )
config.autoload_paths += %W(#{config.root}/app/models/design)
config.autoload_paths += %W(#{config.root}/app/models/purchase)
config.autoload_paths += %W(#{config.root}/app/models/user)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
@@ -53,7 +56,7 @@ module PrototypeR4
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = false
config.assets.enabled = true
end
end
+5
View File
@@ -0,0 +1,5 @@
defaults: &defaults
main_public_key: 'lib/main_public_key.pem'
development:
<<: *defaults
+1
View File
@@ -0,0 +1 @@
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
+18 -77
View File
@@ -2,48 +2,16 @@ 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
# routes for sinatra app
match '/site/set_registered', :to => CentralServerExchangeApp
match '/site/public_key', :to => CentralServerExchangeApp
match '/purchase/design', :to => CentralServerExchangeApp
# routes for admin
namespace :admin do
resources :assets
resources :items do
member do
put :up
put :down
end
end
resources :layouts
resources :designs do
get 'upload_package' ,:on => :collection
post 'upload_package' ,:on => :collection
@@ -52,7 +20,8 @@ PrototypeR4::Application.routes.draw do
get 'delete'
end
end
resources :items
resources :layouts
resources :links do
member do
get 'delete'
@@ -64,59 +33,31 @@ PrototypeR4::Application.routes.draw do
end
end
resources :page_parts
resources :purchases do
member do
get 'download'
end
end
resources :homes
resources :snippets
resources :translations
resources :user_info_models
resources :user_role_models
end
# end admin
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
}
# routes for gridfs files
match "/gridfs/*path" => "gridfs#serve"
# routes for pages to generate
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