1.9 Hash syntax in routes.rb

Also cleans up some alignment and removes unnecessary "to: " arguments
This commit is contained in:
Robert Speicher 2012-09-16 07:22:46 -04:00
parent 94f91146f1
commit d7eb797024
1 changed files with 52 additions and 51 deletions

View File

@ -43,19 +43,19 @@ Gitlab::Application.routes.draw do
put :unblock put :unblock
end end
end end
resources :projects, :constraints => { :id => /[^\/]+/ } do resources :projects, constraints: { id: /[^\/]+/ } do
member do member do
get :team get :team
put :team_update put :team_update
end end
end end
resources :team_members, :only => [:edit, :update, :destroy] resources :team_members, only: [:edit, :update, :destroy]
resources :hooks, :only => [:index, :create, :destroy] do resources :hooks, only: [:index, :create, :destroy] do
get :test get :test
end end
resource :logs, only: [:show] resource :logs, only: [:show]
resource :resque, :controller => 'resque', only: [:show] resource :resque, controller: 'resque', only: [:show]
root :to => "dashboard#index" root to: "dashboard#index"
end end
get "errors/githost" get "errors/githost"
@ -63,31 +63,32 @@ Gitlab::Application.routes.draw do
# #
# Profile Area # Profile Area
# #
get "profile/account", :to => "profile#account" get "profile/account" => "profile#account"
get "profile/history", :to => "profile#history" get "profile/history" => "profile#history"
put "profile/password", :to => "profile#password_update" put "profile/password" => "profile#password_update"
get "profile/token", :to => "profile#token" get "profile/token" => "profile#token"
put "profile/reset_private_token", :to => "profile#reset_private_token" put "profile/reset_private_token" => "profile#reset_private_token"
get "profile", :to => "profile#show" get "profile" => "profile#show"
get "profile/design", :to => "profile#design" get "profile/design" => "profile#design"
put "profile/update", :to => "profile#update" put "profile/update" => "profile#update"
resources :keys resources :keys
# #
# Dashboard Area # Dashboard Area
# #
get "dashboard", :to => "dashboard#index" get "dashboard" => "dashboard#index"
get "dashboard/issues", :to => "dashboard#issues" get "dashboard/issues" => "dashboard#issues"
get "dashboard/merge_requests", :to => "dashboard#merge_requests" get "dashboard/merge_requests" => "dashboard#merge_requests"
resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create] resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks } devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks }
# #
# Project Area # Project Area
# #
resources :projects, :constraints => { :id => /[^\/]+/ }, :except => [:new, :create, :index], :path => "/" do resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do
member do member do
get "team" get "team"
get "wall" get "wall"
@ -95,7 +96,7 @@ Gitlab::Application.routes.draw do
get "files" get "files"
end end
resources :wikis, :only => [:show, :edit, :destroy, :create] do resources :wikis, only: [:show, :edit, :destroy, :create] do
collection do collection do
get :pages get :pages
end end
@ -114,46 +115,45 @@ Gitlab::Application.routes.draw do
end end
resources :deploy_keys resources :deploy_keys
resources :protected_branches, :only => [:index, :create, :destroy] resources :protected_branches, only: [:index, :create, :destroy]
resources :refs, :only => [], :path => "/" do resources :refs, only: [], path: "/" do
collection do collection do
get "switch" get "switch"
end end
member do member do
get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ } get "tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
get "logs_tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ } get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
get "blob", get "blob",
:constraints => { constraints: {
:id => /[a-zA-Z.0-9\/_\-]+/, id: /[a-zA-Z.0-9\/_\-]+/,
:path => /.*/ path: /.*/
} }
# tree viewer # tree viewer
get "tree/:path" => "refs#tree", get "tree/:path" => "refs#tree",
:as => :tree_file, as: :tree_file,
:constraints => { constraints: {
:id => /[a-zA-Z.0-9\/_\-]+/, id: /[a-zA-Z.0-9\/_\-]+/,
:path => /.*/ path: /.*/
} }
# tree viewer # tree viewer
get "logs_tree/:path" => "refs#logs_tree", get "logs_tree/:path" => "refs#logs_tree",
:as => :logs_file, as: :logs_file,
:constraints => { constraints: {
:id => /[a-zA-Z.0-9\/_\-]+/, id: /[a-zA-Z.0-9\/_\-]+/,
:path => /.*/ path: /.*/
} }
# blame # blame
get "blame/:path" => "refs#blame", get "blame/:path" => "refs#blame",
:as => :blame_file, as: :blame_file,
:constraints => { constraints: {
:id => /[a-zA-Z.0-9\/_\-]+/, id: /[a-zA-Z.0-9\/_\-]+/,
:path => /.*/ path: /.*/
} }
end end
end end
@ -178,7 +178,7 @@ Gitlab::Application.routes.draw do
end end
end end
resources :hooks, :only => [:index, :create, :destroy] do resources :hooks, only: [:index, :create, :destroy] do
member do member do
get :test get :test
end end
@ -194,7 +194,7 @@ Gitlab::Application.routes.draw do
end end
resources :team_members resources :team_members
resources :milestones resources :milestones
resources :labels, :only => [:index] resources :labels, only: [:index]
resources :issues do resources :issues do
collection do collection do
@ -203,11 +203,12 @@ Gitlab::Application.routes.draw do
get :search get :search
end end
end end
resources :notes, :only => [:index, :create, :destroy] do resources :notes, only: [:index, :create, :destroy] do
collection do collection do
post :preview post :preview
end end
end end
end end
root :to => "dashboard#index"
root to: "dashboard#index"
end end