clean up routes.rb a bit

This commit is contained in:
MrZYX 2011-07-12 16:47:04 +02:00
parent 5934616422
commit 7e84747a52

View file

@ -4,20 +4,19 @@
Diaspora::Application.routes.draw do Diaspora::Application.routes.draw do
# Posting and Reading # Posting and Reading
resources :aspects do resources :aspects do
put 'toggle_contact_visibility' => :toggle_contact_visibility put :toggle_contact_visibility
end end
resources :status_messages, :only => [:new, :create] do resources :status_messages, :only => [:new, :create]
end
resources :posts, :only => [:show, :destroy] do resources :posts, :only => [:show, :destroy] do
resources :likes, :only => [:create, :destroy, :index] resources :likes, :only => [:create, :destroy, :index]
resources :comments, :only => [:create, :destroy, :index] resources :comments, :only => [:create, :destroy, :index]
end end
get 'p/:id' => 'publics#post', :as => 'public_post'
# roll up likes into a nested resource above # roll up likes into a nested resource above
resources :comments, :only => [:create, :destroy] do resources :comments, :only => [:create, :destroy] do
@ -26,10 +25,9 @@ Diaspora::Application.routes.draw do
get 'bookmarklet' => 'status_messages#bookmarklet' get 'bookmarklet' => 'status_messages#bookmarklet'
get 'p/:id' => 'publics#post', :as => 'public_post'
resources :photos, :except => [:index] do resources :photos, :except => [:index] do
put 'make_profile_photo' => :make_profile_photo put :make_profile_photo
end end
# ActivityStreams routes # ActivityStreams routes
@ -43,16 +41,22 @@ Diaspora::Application.routes.draw do
end end
resources :notifications, :only => [:index, :update] do resources :notifications, :only => [:index, :update] do
get 'read_all' => :read_all, :on => :collection get :read_all, :on => :collection
end end
resources :tags, :only => [:index] resources :tags, :only => [:index]
post "/tags/:name/tag_followings" => "tag_followings#create", :as => 'tag_tag_followings' scope "tags/:name" do
delete "/tags/:name/tag_followings" => "tag_followings#destroy" post "tag_followings" => "tag_followings#create", :as => 'tag_tag_followings'
delete "tag_followings" => "tag_followings#destroy"
end
get 'tags/:name' => 'tags#show', :as => 'tag' get 'tags/:name' => 'tags#show', :as => 'tag'
resources :apps, :only => [:show] resources :apps, :only => [:show]
#Cubbies info page
resource :token, :only => :show
# Users and people # Users and people
resource :user, :only => [:edit, :update, :destroy], :shallow => true do resource :user, :only => [:edit, :update, :destroy], :shallow => true do
@ -60,7 +64,6 @@ Diaspora::Application.routes.draw do
get :export_photos get :export_photos
end end
controller :users do controller :users do
get 'public/:username' => :public, :as => 'users_public' get 'public/:username' => :public, :as => 'users_public'
match 'getting_started' => :getting_started, :as => 'getting_started' match 'getting_started' => :getting_started, :as => 'getting_started'
@ -78,16 +81,13 @@ Diaspora::Application.routes.draw do
get 'invitations/resend/:id' => 'invitations#resend', :as => 'invitation_resend' get 'invitations/resend/:id' => 'invitations#resend', :as => 'invitation_resend'
end end
#Cubbies info page
resource :token, :only => :show
get 'login' => redirect('/users/sign_in') get 'login' => redirect('/users/sign_in')
scope 'admins', :controller => :admins do scope 'admins', :controller => :admins do
match 'user_search' => :user_search match :user_search
get 'admin_inviter' => :admin_inviter get :admin_inviter
get 'add_invites' => :add_invites, :as => 'add_invites' get :add_invites, :as => 'add_invites'
get 'stats' => :stats, :as => 'pod_stats' get :stats, :as => 'pod_stats'
end end
resource :profile resource :profile
@ -98,21 +98,17 @@ Diaspora::Application.routes.draw do
resources :aspect_memberships, :only => [:destroy, :create, :update] resources :aspect_memberships, :only => [:destroy, :create, :update]
resources :post_visibilities, :only => [:update] resources :post_visibilities, :only => [:update]
resources :people, :except => [:edit, :update] do resources :people, :except => [:edit, :update] do
resources :status_messages resources :status_messages
resources :photos resources :photos
get :contacts get :contacts
get "aspect_membership_button" => :aspect_membership_dropdown, :as => "aspect_membership_button"
collection do collection do
post 'by_handle' => :retrieve_remote, :as => 'person_by_handle' post 'by_handle' => :retrieve_remote, :as => 'person_by_handle'
get :tag_index get :tag_index
end end
end end
get "people/:id/aspect_membership_button" => "people#aspect_membership_dropdown", :as => "aspect_membership_button"
# Federation # Federation
@ -127,17 +123,19 @@ Diaspora::Application.routes.draw do
# External # External
get "/oauth/authorize" => "authorizations#new"
post "/oauth/authorize" => "authorizations#create"
post "/oauth/token" => "authorizations#token"
resources :authorizations, :only => [:index, :destroy] resources :authorizations, :only => [:index, :destroy]
scope "/oauth", :controller => :authorizations, :as => "oauth" do
get "authorize" => :new
post "authorize" => :create
post :token
end
resources :services, :only => [:index, :destroy] resources :services, :only => [:index, :destroy]
controller :services do controller :services do
match '/auth/:provider/callback' => :create scope "/auth", :as => "auth" do
match '/auth/failure' => :failure match ':provider/callback' => :create
match :failure
end
scope 'services' do scope 'services' do
match 'inviter/:provider' => :inviter, :as => 'service_inviter' match 'inviter/:provider' => :inviter, :as => 'service_inviter'
match 'finder/:provider' => :finder, :as => 'friend_finder' match 'finder/:provider' => :finder, :as => 'friend_finder'
@ -145,7 +143,7 @@ Diaspora::Application.routes.draw do
end end
scope 'api/v0', :controller => :apis do scope 'api/v0', :controller => :apis do
get 'me' => :me get :me
end end