/config/routes.rb

https://github.com/robustdj/alonetone · Ruby · 108 lines · 72 code · 29 blank · 7 comment · 0 complexity · 0ab692b48763121f8c37155c1e6034f4 MD5 · raw file

  1. ActionController::Routing::Routes.draw do |map|
  2. map.resources :groups
  3. map.admin 'secretz', :controller => 'secretz'
  4. map.rpm_challenge 'rpmchallenge', :controller => 'pages', :action => 'rpm_challenge'
  5. map.twentyfour '24houralbum', :controller => 'pages', :action => 'twentyfour'
  6. map.feedback 'feedback', :controller => 'user_reports'
  7. map.resources :features, :sessions, :user_reports
  8. map.blog_home 'blog', :controller => 'updates', :action => 'index'
  9. map.resources :blog, :controller => 'updates'
  10. map.resources :updates
  11. map.resources :comments, :member => {:unspam => :get}
  12. map.sitemap 'sitemap.xml', :controller => 'pages', :action => 'sitemap', :format => 'xml'
  13. map.about 'about/:action', :controller => 'pages'
  14. map.halp 'about/halp/:action', :controller => 'pages'
  15. map.signup 'signup', :controller => 'users', :action => 'new'
  16. map.settings 'settings', :controller => 'users', :action => 'edit'
  17. map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate'
  18. map.login 'login', :controller => 'sessions', :action => 'create'
  19. map.logout 'logout', :controller => 'sessions', :action => 'destroy'
  20. # shortcut to profile
  21. map.profile ':login/bio', :controller => 'users', :action => 'bio'
  22. map.connect '/latest.:format', :controller => 'assets', :action => 'latest'
  23. # latest mp3s uploaded site-wide
  24. map.latest '/latest/:latest', :controller => 'assets', :action => 'latest'
  25. map.listen_feed '/:login/listenfeed.:format', :controller => 'assets', :action => 'listen_feed'
  26. map.radio_home 'radio', :controller => 'assets', :action => 'radio'
  27. map.radio 'radio/:source/:per_page/:page', :controller => 'assets', :action => 'radio', :defaults =>{:per_page => 5, :page => 1}
  28. # top 40
  29. map.top '/top/:top', :controller => 'assets', :action => 'top'
  30. map.users_default '/users/by/activity/:page', :controller => 'users', :action => 'index', :sort => 'active', :defaults => {:page => 1}
  31. map.sorted_users '/users/by/:sort/:page', :controller => 'users', :action => 'index', :defaults => {:page => 1}
  32. map.listens ':login/history', :controller => 'listens'
  33. map.all_comments 'comments', :controller => 'comments'
  34. map.user_comments ':login/comments', :controller => 'comments'
  35. map.user_stats ':login/stats.:format', :controller => 'users', :action => 'stats'
  36. map.hot_track 'hot_track/:position.:format',
  37. :controller => 'assets',
  38. :action => 'hot_track',
  39. :format => 'mp3'
  40. map.user_plus ':login/plus', :controller => 'source_files', :action => 'index'
  41. map.resources :forums, :has_many => :posts do |forum|
  42. forum.resources :topics do |topic|
  43. topic.resources :posts
  44. end
  45. forum.resources :posts
  46. end
  47. map.resources :posts, :collection => {:search => :get}
  48. map.resources :users, :controller => :users,
  49. :member => {:attach_pic => :post, :sudo => :any,
  50. :toggle_follow => :any} do |user|
  51. user.resources :source_files, :path_prefix => ':login'
  52. # TODO: Confusing, because Tracks is also a model. Don't confuse this route, this is indeed for the Assets model
  53. user.resources :tracks, :controller => :assets, :member => {:share => :get, :destroy => :any, :stats => :get}, :collection => {:latest => :get, :search => :post, :mass_edit => :get}, :path_prefix => ':login', :member_path => ':login/tracks/:id' do |track|
  54. track.resources :comments
  55. end
  56. user.favorites 'favorites', :controller => 'playlists', :action => 'favorites',:path_prefix => ':login'
  57. user.posts 'posts', :controller => 'posts', :action => 'index', :path_prefix => ':login'
  58. # TODO - figure out a way to use :member_path with rails 2
  59. # http://dev.rubyonrails.org/changeset/8227
  60. # for now, i have to specify port to allow :permalink and :id to be sent at the same time
  61. user.resources :playlists, :collection => {:latest => :get, :sort => :any},
  62. :member=> {:set_playlist_title => :post, :set_playlist_description => :post,
  63. :attach_pic => :post, :remove_track => :any, :sort_tracks => :post,
  64. :add_track => :post, :destroy => :any},
  65. :path_prefix => ':login' do |playlist|
  66. playlist.resources :comments
  67. end
  68. end
  69. map.toggle_favorite 'toggle_favorite', :controller => 'users', :action => 'toggle_favorite'
  70. map.search 'search', :controller => 'search', :action => 'index'
  71. map.search_query 'search/:query', :controller => 'search', :action => 'index'
  72. map.namespace(:admin) do |admin|
  73. admin.resources :layouts
  74. admin.resources :users
  75. end
  76. map.root :controller => 'assets', :action => 'latest'
  77. map.user_home ':login', :controller => 'users', :action => 'show'
  78. map.user_feeds ':login.:format', :controller => 'users', :action => 'show'
  79. end