]> git.openstreetmap.org Git - rails.git/blobdiff - config/routes.rb
Merge remote-tracking branch 'upstream/pull/2673'
[rails.git] / config / routes.rb
index f8e69e80a79acb89580f35efff2a034f380691ed..a98a114302d0576d33fecc637056107d647af49b 100644 (file)
@@ -61,23 +61,23 @@ OpenStreetMap::Application.routes.draw do
 
     get "changes" => "api/changes#index"
 
 
     get "changes" => "api/changes#index"
 
-    get "user/:id" => "api/users#show", :id => /\d+/
+    get "user/:id" => "api/users#show", :id => /\d+/, :as => :api_user
     get "user/details" => "api/users#details"
     get "user/gpx_files" => "api/users#gpx_files"
     get "users" => "api/users#index", :as => :api_users
 
     get "user/details" => "api/users#details"
     get "user/gpx_files" => "api/users#gpx_files"
     get "users" => "api/users#index", :as => :api_users
 
-    get "user/preferences" => "api/user_preferences#index"
-    get "user/preferences/:preference_key" => "api/user_preferences#show"
-    put "user/preferences" => "api/user_preferences#update_all"
-    put "user/preferences/:preference_key" => "api/user_preferences#update"
-    delete "user/preferences/:preference_key" => "api/user_preferences#destroy"
+    resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences", :controller => "api/user_preferences" do
+      collection do
+        put "" => "api/user_preferences#update_all", :as => ""
+      end
+    end
 
     post "gpx/create" => "api/traces#create"
 
     post "gpx/create" => "api/traces#create"
-    get "gpx/:id" => "api/traces#show", :id => /\d+/
+    get "gpx/:id" => "api/traces#show", :as => :api_trace, :id => /\d+/
     put "gpx/:id" => "api/traces#update", :id => /\d+/
     delete "gpx/:id" => "api/traces#destroy", :id => /\d+/
     get "gpx/:id/details" => "api/traces#show", :id => /\d+/
     put "gpx/:id" => "api/traces#update", :id => /\d+/
     delete "gpx/:id" => "api/traces#destroy", :id => /\d+/
     get "gpx/:id/details" => "api/traces#show", :id => /\d+/
-    get "gpx/:id/data" => "api/traces#data"
+    get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data
 
     # AMF (ActionScript) API
     post "amf/read" => "api/amf#amf_read"
 
     # AMF (ActionScript) API
     post "amf/read" => "api/amf#amf_read"
@@ -161,7 +161,7 @@ OpenStreetMap::Application.routes.draw do
   post "/user/new" => "users#create"
   get "/user/terms" => "users#terms"
   post "/user/save" => "users#save"
   post "/user/new" => "users#create"
   get "/user/terms" => "users#terms"
   post "/user/save" => "users#save"
-  get "/user/:display_name/confirm/resend" => "users#confirm_resend"
+  get "/user/:display_name/confirm/resend" => "users#confirm_resend", :as => :user_confirm_resend
   match "/user/:display_name/confirm" => "users#confirm", :via => [:get, :post]
   match "/user/confirm" => "users#confirm", :via => [:get, :post]
   match "/user/confirm-email" => "users#confirm_email", :via => [:get, :post]
   match "/user/:display_name/confirm" => "users#confirm", :via => [:get, :post]
   match "/user/confirm" => "users#confirm", :via => [:get, :post]
   match "/user/confirm-email" => "users#confirm_email", :via => [:get, :post]
@@ -235,12 +235,13 @@ OpenStreetMap::Application.routes.draw do
   post "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/
 
   # user pages
   post "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/
 
   # user pages
-  get "/user/:display_name" => "users#show", :as => "user"
-  match "/user/:display_name/make_friend" => "users#make_friend", :via => [:get, :post], :as => "make_friend"
-  match "/user/:display_name/remove_friend" => "users#remove_friend", :via => [:get, :post], :as => "remove_friend"
-  match "/user/:display_name/account" => "users#account", :via => [:get, :post]
-  get "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
-  get "/user/:display_name/delete" => "users#delete", :as => :delete_user
+  resources :users, :path => "user", :param => :display_name, :only => [:show, :destroy]
+  match "/user/:display_name/account" => "users#account", :via => [:get, :post], :as => "user_account"
+  post "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
+
+  # friendships
+  match "/user/:display_name/make_friend" => "friendships#make_friend", :via => [:get, :post], :as => "make_friend"
+  match "/user/:display_name/remove_friend" => "friendships#remove_friend", :via => [:get, :post], :as => "remove_friend"
 
   # user lists
   match "/users" => "users#index", :via => [:get, :post]
 
   # user lists
   match "/users" => "users#index", :via => [:get, :post]