X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a25b7953b3889ce6847a13c579fa9fd32219b5e3..c7e038a4d098ef9f42eb13edf29aef24cbd537ef:/config/routes.rb diff --git a/config/routes.rb b/config/routes.rb index af72c457d..58d629d69 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -71,31 +71,30 @@ OpenStreetMap::Application.routes.draw do get "user/details" => "users#details" get "user/gpx_files" => "users#gpx_files" get "users" => "users#index", :as => :api_users + end - resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences", :controller => "user_preferences" do + namespace :api, :path => "api/0.6" do + resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do collection do put "" => "user_preferences#update_all", :as => "" end end - resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :destroy], :controller => "messages", :as => :api_messages do - collection do - get "inbox" - get "outbox" - end + resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :update, :destroy] + namespace :messages, :path => "user/messages" do + resource :inbox, :only => :show + resource :outbox, :only => :show end + post "/user/messages/:id" => "messages#update", :as => nil - post "/user/messages/:id" => "messages#update", :as => :api_message_update - - post "gpx/create" => "traces#create" - get "gpx/:id" => "traces#show", :as => :api_trace, :id => /\d+/ - put "gpx/:id" => "traces#update", :id => /\d+/ - delete "gpx/:id" => "traces#destroy", :id => /\d+/ - get "gpx/:id/details" => "traces#show", :id => /\d+/ - get "gpx/:id/data" => "traces#data", :as => :api_trace_data - end + resources :traces, :path => "gpx", :only => [:create, :show, :update, :destroy], :id => /\d+/ do + scope :module => :traces do + resource :data, :only => :show + end + end + post "gpx/create" => "traces#create", :id => /\d+/, :as => :trace_create + get "gpx/:id/details" => "traces#show", :id => /\d+/, :as => :trace_details - namespace :api, :path => "api/0.6" do # Map notes API resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do collection do @@ -108,6 +107,8 @@ OpenStreetMap::Application.routes.draw do post "close" post "reopen" end + + resource :subscription, :only => [:create, :destroy], :controller => "note_subscriptions" end resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks" @@ -124,7 +125,8 @@ OpenStreetMap::Application.routes.draw do get "/relation/:id/history" => "old_relations#index", :id => /\d+/, :as => :relation_history resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show resources :changesets, :path => "changeset", :id => /\d+/, :only => :show do - match :subscribe, :unsubscribe, :on => :member, :via => [:get, :post] + match :subscribe, :on => :member, :via => [:get, :post] + match :unsubscribe, :on => :member, :via => [:get, :post] namespace :changeset_comments, :as => :comments, :path => :comments do resource :feed, :only => :show, :defaults => { :format => "rss" } @@ -255,7 +257,8 @@ OpenStreetMap::Application.routes.draw do scope "/user/:display_name" do resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ do member do - post :hide, :unhide + post :hide + post :unhide end end end @@ -286,8 +289,9 @@ OpenStreetMap::Application.routes.draw do match "/user/:display_name/remove_friend" => "friendships#remove_friend", :via => [:get, :post], :as => "remove_friend" # user lists - match "/users" => "users#index", :via => [:get, :post] - match "/users/:status" => "users#index", :via => [:get, :post] + namespace :users do + resource :list, :path => "(:status)", :only => [:show, :update] + end # geocoder get "/search" => "geocoder#search" @@ -303,16 +307,16 @@ OpenStreetMap::Application.routes.draw do get "/export/embed" => "export#embed" # messages - resources :messages, :only => [:create, :show, :destroy] do + resources :messages, :id => /\d+/, :only => [:create, :show, :destroy] do post :mark patch :unmute match :reply, :via => [:get, :post] - collection do - get :inbox - get :muted - get :outbox - end + end + namespace :messages, :path => "/messages" do + resource :inbox, :only => :show + resource :muted_inbox, :path => "muted", :only => :show + resource :outbox, :only => :show end get "/user/:display_name/inbox", :to => redirect(:path => "/messages/inbox") get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")