Guest User

Untitled

a guest
Jul 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. #
  2. #
  3. # NOTE: make sure to update the validates_handle function whenever you add a new controller
  4. # or a new root path route. This way, group and user handles will not be created for those
  5. # (group name or user login are used as the :context in the default route, so it can't collide
  6. # with any of our other routes).
  7. #
  8.  
  9. ActionController::Routing::Routes.draw do |map|
  10.  
  11. # total hackety magic:
  12. map.filter 'crabgrass_routing_filter'
  13.  
  14. ##
  15. ## PLUGINS
  16. ##
  17.  
  18. # optionally load these plugin routes, if they happen to be loaded
  19. map.from_plugin :super_admin rescue NameError
  20. map.from_plugin :translator rescue NameError
  21. map.from_plugin :moderation rescue NameError
  22.  
  23. map.namespace :admin do |admin|
  24. admin.resources :announcements
  25. admin.resources :email_blasts
  26. admin.resources :users, :only => [:new, :create]
  27. admin.resources :groups, :only => [:new, :create]
  28. admin.resources :custom_appearances, :only => [:edit, :update]
  29. admin.sites 'sites/:action', :controller => 'sites'
  30. admin.root :controller => 'base'
  31. end
  32.  
  33. ##
  34. ## ASSET
  35. ##
  36.  
  37. map.connect '/assets/:action/:id', :controller => 'assets', :action => /create|destroy/
  38. map.connect 'assets/:id/versions/:version/*path', :controller => 'assets', :action => 'show'
  39. map.connect 'assets/:id/*path', :controller => 'assets', :action => 'show'
  40.  
  41. map.avatar 'avatars/:id/:size.jpg', :action => 'avatar', :controller => 'static'
  42. map.connect 'latex/*path', :action => 'show', :controller => 'latex'
  43.  
  44. ##
  45. ## ME
  46. ##
  47.  
  48. map.connect 'me/inbox/:action/*path', :controller => 'me/inbox'
  49. map.connect 'me/requests/:action/*path', :controller => 'me/requests'
  50. map.connect 'me/search/*path', :controller => 'me/search', :action => 'index'
  51. map.connect 'me/dashboard/:action/*path', :controller => 'me/dashboard'
  52. map.connect 'me/tasks/:action/*path', :controller => 'me/tasks'
  53. map.connect 'me/infoviz.:format', :controller => 'me/infoviz', :action => 'visualize'
  54. map.connect 'me/trash/:action/*path', :controller => 'me/trash'
  55.  
  56. map.with_options(:namespace => 'me/', :path_prefix => 'me') do |me|
  57. me.resources :my_private_messages, :as => 'messages/private', :controller => 'private_messages'
  58. me.resources :my_public_messages, :as => 'messages/public', :controller => 'public_messages'
  59. me.resources :my_messages, :as => 'messages', :controller => 'messages'
  60. end
  61.  
  62. map.connect 'me/:action/:id', :controller => 'me'
  63.  
  64. ##
  65. ## PEOPLE
  66. ##
  67.  
  68. map.resources :people_directory, :as => 'directory', :path_prefix => 'people', :controller => 'people/directory'
  69.  
  70. map.with_options(:namespace => 'people/') do |people_space|
  71. people_space.resources :people do |people|
  72. people.resources :messages
  73. end
  74. end
  75.  
  76. map.connect 'person/:action/:id/*path', :controller => 'person'
  77.  
  78. ##
  79. ## EMAIL
  80. ##
  81.  
  82. map.connect '/invites/:action/*path', :controller => 'requests', :action => /accept/
  83. map.connect '/code/:id', :controller => 'codes', :action => 'jump'
  84.  
  85. ##
  86. ## PAGES
  87. ##
  88.  
  89. # handle all the namespaced base_page controllers:
  90. map.connect ':controller/:action/:id', :controller => /base_page\/[^\/]+/
  91. #map.connect 'pages/search/*path', :controller => 'pages', :action => 'search'
  92.  
  93. ##
  94. ## OTHER
  95. ##
  96.  
  97. map.login 'account/login', :controller => 'account', :action => 'login'
  98. #map.resources :custom_appearances, :only => [:edit, :update]
  99. map.reset_password '/reset_password/:token', :controller => 'account', :action => 'reset_password'
  100. map.account_verify '/verify_email/:token', :controller => 'account', :action => 'verify_email'
  101. map.account '/account/:action/:id', :controller => 'account'
  102.  
  103. map.connect '', :controller => 'root'
  104.  
  105. map.connect 'bugreport/submit', :controller => 'bugreport', :action => 'submit'
  106.  
  107. ##
  108. ## GROUP
  109. ##
  110.  
  111. map.group_directory 'groups/directory/:action/:id', :controller => 'groups/directory'
  112. map.network_directory 'networks/directory/:action/:id', :controller => 'networks/directory'
  113.  
  114. map.groups 'groups/:action/:id', :controller => 'groups'
  115. map.connect 'groups/:action/:id/*path', :controller => 'groups', :action => /search|archive|discussions|tags|trash/
  116.  
  117. map.networks 'networks/:action/:id', :controller => 'networks'
  118. map.connect 'networks/:action/:id/*path', :controller => 'networks', :action => /search|archive|discussions|tags|trash/
  119.  
  120. ##
  121. ## CHAT
  122. ##
  123. map.chat 'chat/:action/:id', :controller => 'chat'
  124. map.chat_archive 'chat/archive/:id/date/:date', :controller => 'chat', :action => 'archive'
  125. # map.connect 'chat/archive/:id/*path', :controller => 'chat', :action => 'archive'
  126. ##
  127. ## DEFAULT ROUTE
  128. ##
  129.  
  130. map.connect ':controller/:action/:id'
  131.  
  132.  
  133. ##
  134. ## DISPATCHER
  135. ##
  136.  
  137. map.connect 'page/:_page/:_page_action/:id', :controller => 'dispatch', :action => 'dispatch', :_page_action => 'show', :id => nil
  138.  
  139. map.connect ':_context/:_page/:_page_action/:id', :controller => 'dispatch', :action => 'dispatch', :_page_action => 'show', :id => nil
  140.  
  141. map.connect ':_context', :controller => 'dispatch', :action => 'dispatch', :_page => nil
  142.  
  143. # i am not sure what this was for, but it breaks routes for committees. this
  144. # could be fixed by adding \+, but i am just commenting it out for now. -e
  145. # :_context => /[\w\.\@\s-]+/
  146.  
  147. end
Add Comment
Please, Sign In to add comment