2010-07-02 02:12:00 -04:00
|
|
|
Rails.application.routes.draw do
|
2010-07-07 04:51:14 -04:00
|
|
|
# Resources for testing
|
2010-06-29 15:41:34 -04:00
|
|
|
resources :users, :only => [:index] do
|
2010-02-16 10:11:30 -05:00
|
|
|
get :expire, :on => :member
|
2010-06-29 15:41:34 -04:00
|
|
|
get :accept, :on => :member
|
2011-06-28 21:13:35 -04:00
|
|
|
|
|
|
|
authenticate :user do
|
|
|
|
post :exhibit, :on => :member
|
|
|
|
end
|
2010-02-16 10:11:30 -05:00
|
|
|
end
|
|
|
|
|
2010-02-17 07:15:19 -05:00
|
|
|
resources :admins, :only => [:index]
|
|
|
|
|
2010-07-07 04:51:14 -04:00
|
|
|
# Users scope
|
2010-10-14 17:46:10 -04:00
|
|
|
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } do
|
2010-07-07 04:51:14 -04:00
|
|
|
match "/devise_for/sign_in", :to => "devise/sessions#new"
|
|
|
|
end
|
|
|
|
|
|
|
|
as :user do
|
|
|
|
match "/as/sign_in", :to => "devise/sessions#new"
|
|
|
|
end
|
|
|
|
|
|
|
|
match "/sign_in", :to => "devise/sessions#new"
|
|
|
|
|
|
|
|
# Admin scope
|
2011-04-25 04:00:28 -04:00
|
|
|
devise_for :admin, :path => "admin_area", :controllers => { :sessions => :"admins/sessions" }, :skip => :passwords
|
2010-06-30 06:41:44 -04:00
|
|
|
|
2010-07-07 04:51:14 -04:00
|
|
|
match "/admin_area/home", :to => "admins#index", :as => :admin_root
|
|
|
|
match "/anywhere", :to => "foo#bar", :as => :new_admin_password
|
|
|
|
|
|
|
|
authenticate(:admin) do
|
|
|
|
match "/private", :to => "home#private", :as => :private
|
|
|
|
end
|
2011-06-22 22:44:46 -04:00
|
|
|
|
|
|
|
authenticated :admin do
|
|
|
|
match "/dashboard", :to => "home#admin_dashboard"
|
|
|
|
end
|
|
|
|
|
|
|
|
authenticated do
|
|
|
|
match "/dashboard", :to => "home#user_dashboard"
|
|
|
|
end
|
|
|
|
|
|
|
|
unauthenticated do
|
|
|
|
match "/join", :to => "home#join"
|
|
|
|
end
|
|
|
|
|
2011-06-17 00:24:20 -04:00
|
|
|
# Routes for constraints testing
|
2011-06-17 09:46:39 -04:00
|
|
|
devise_for :headquarters_admin, :class_name => "Admin", :path => "headquarters", :constraints => {:host => /192\.168\.1\.\d\d\d/}
|
2011-06-17 00:24:20 -04:00
|
|
|
|
|
|
|
constraints(:host => /192\.168\.1\.\d\d\d/) do
|
2011-06-17 09:46:39 -04:00
|
|
|
devise_for :homebase_admin, :class_name => "Admin", :path => "homebase"
|
2011-06-17 00:24:20 -04:00
|
|
|
end
|
|
|
|
|
2011-06-27 07:51:04 -04:00
|
|
|
# Routes for format=false testing
|
|
|
|
devise_for :htmlonly_admin, :class_name => "Admin", :skip => [:confirmations, :unlocks], :path => "htmlonly_admin", :format => false
|
|
|
|
devise_for :htmlonly_users, :class_name => "User", :only => [:confirmations, :unlocks], :path => "htmlonly_users", :format => false
|
|
|
|
|
2010-07-07 04:51:14 -04:00
|
|
|
# Other routes for routing_test.rb
|
2011-04-15 04:12:44 -04:00
|
|
|
devise_for :reader, :class_name => "User", :only => :passwords
|
|
|
|
|
2010-09-26 15:11:28 -04:00
|
|
|
namespace :publisher, :path_names => { :sign_in => "i_dont_care", :sign_out => "get_out" } do
|
2010-10-14 18:44:21 -04:00
|
|
|
devise_for :accounts, :class_name => "Admin", :path_names => { :sign_in => "get_in" }
|
2010-07-04 05:53:12 -04:00
|
|
|
end
|
|
|
|
|
2010-06-30 06:41:44 -04:00
|
|
|
scope ":locale" do
|
2010-10-14 18:44:21 -04:00
|
|
|
devise_for :accounts, :singular => "manager", :class_name => "Admin",
|
2010-06-30 06:41:44 -04:00
|
|
|
:path_names => {
|
|
|
|
:sign_in => "login", :sign_out => "logout",
|
|
|
|
:password => "secret", :confirmation => "verification",
|
|
|
|
:unlock => "unblock", :sign_up => "register",
|
2010-07-15 15:58:35 -04:00
|
|
|
:registration => "management", :cancel => "giveup"
|
2010-06-30 06:41:44 -04:00
|
|
|
}
|
|
|
|
end
|
2009-10-12 20:49:51 -04:00
|
|
|
|
2010-09-26 15:11:28 -04:00
|
|
|
namespace :sign_out_via, :module => "devise" do
|
2010-10-14 18:44:21 -04:00
|
|
|
devise_for :deletes, :sign_out_via => :delete, :class_name => "Admin"
|
|
|
|
devise_for :posts, :sign_out_via => :post, :class_name => "Admin"
|
|
|
|
devise_for :delete_or_posts, :sign_out_via => [:delete, :post], :class_name => "Admin"
|
2010-08-12 17:46:00 -04:00
|
|
|
end
|
|
|
|
|
2010-07-15 15:58:35 -04:00
|
|
|
match "/set", :to => "home#set"
|
2010-11-09 17:42:14 -05:00
|
|
|
match "/unauthenticated", :to => "home#unauthenticated"
|
2011-06-28 21:13:35 -04:00
|
|
|
|
2010-02-17 07:15:19 -05:00
|
|
|
root :to => "home#index"
|
2011-06-27 07:51:04 -04:00
|
|
|
end
|