X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d87d06fee55c4827ade4590280f0caaf297a8217..d975100504a87788df9386ceee455e76ebfade64:/config/routes.rb?ds=sidebyside diff --git a/config/routes.rb b/config/routes.rb index 819baf65a..22c4ad642 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ OpenStreetMap::Application.routes.draw do post "changeset/:id/unsubscribe" => "changesets#unsubscribe", :as => :api_changeset_unsubscribe, :id => /\d+/ put "changeset/:id" => "changesets#update", :id => /\d+/ put "changeset/:id/close" => "changesets#close", :as => :changeset_close, :id => /\d+/ - get "changesets" => "changesets#query" + get "changesets" => "changesets#index" post "changeset/:id/comment" => "changeset_comments#create", :as => :changeset_comment, :id => /\d+/ post "changeset/comment/:id/hide" => "changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/ post "changeset/comment/:id/unhide" => "changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/ @@ -78,15 +78,26 @@ OpenStreetMap::Application.routes.draw do 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 + end + + 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 + namespace :api, :path => "api/0.6" do # Map notes API - resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "notes", :as => :api_notes do + resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do collection do get "search" get "feed", :defaults => { :format => "rss" } @@ -99,36 +110,33 @@ OpenStreetMap::Application.routes.draw do end end - post "notes/addPOIexec" => "notes#create" - post "notes/closePOIexec" => "notes#close" - post "notes/editPOIexec" => "notes#comment" - get "notes/getGPX" => "notes#index", :format => "gpx" - get "notes/getRSSfeed" => "notes#feed", :format => "rss" - - resources :user_blocks, :only => [:show], :constraints => { :id => /\d+/ }, :controller => "user_blocks", :as => :api_user_blocks + resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks" end # Data browsing - get "/way/:id" => "browse#way", :id => /\d+/, :as => :way + get "/way/:id" => "ways#show", :id => /\d+/, :as => :way get "/way/:id/history" => "old_ways#index", :id => /\d+/, :as => :way_history resources :old_ways, :path => "/way/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show - get "/node/:id" => "browse#node", :id => /\d+/, :as => :node + get "/node/:id" => "nodes#show", :id => /\d+/, :as => :node get "/node/:id/history" => "old_nodes#index", :id => /\d+/, :as => :node_history resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show - get "/relation/:id" => "browse#relation", :id => /\d+/, :as => :relation + get "/relation/:id" => "relations#show", :id => /\d+/, :as => :relation 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 - get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" } - resources :notes, :path => "note", :only => [:show, :new] + resources :changesets, :path => "changeset", :id => /\d+/, :only => :show do + match :subscribe, :unsubscribe, :on => :member, :via => [:get, :post] + + namespace :changeset_comments, :as => :comments, :path => :comments do + resource :feed, :only => :show, :defaults => { :format => "rss" } + end + end + resources :notes, :path => "note", :id => /\d+/, :only => [:show, :new] get "/user/:display_name/history" => "changesets#index" get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom } get "/user/:display_name/notes" => "notes#index", :as => :user_notes get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html } get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html } - match "/changeset/:id/subscribe" => "changesets#subscribe", :via => [:get, :post], :as => "changeset_subscribe" - match "/changeset/:id/unsubscribe" => "changesets#unsubscribe", :via => [:get, :post], :as => "changeset_unsubscribe" get "/browse/way/:id", :to => redirect(:path => "/way/%{id}") get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history") @@ -159,7 +167,11 @@ OpenStreetMap::Application.routes.draw do get "/communities" => "site#communities" get "/history" => "changesets#index" get "/history/feed" => "changesets#feed", :defaults => { :format => :atom } - get "/history/comments/feed" => "changeset_comments#index", :as => :changesets_comments_feed, :defaults => { :format => "rss" } + scope "/history" do + namespace :changeset_comments, :path => :comments, :as => :changesets_comments do + resource :feed, :only => :show, :defaults => { :format => "rss" } + end + end get "/export" => "site#export" get "/login" => "sessions#new" post "/login" => "sessions#create" @@ -209,8 +221,10 @@ OpenStreetMap::Application.routes.draw do get "/user/:display_name/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss } get "/user/:display_name/traces/rss" => "traces#georss", :defaults => { :format => :rss } get "/user/:display_name/traces/:id" => "traces#show", :as => "show_trace" - get "/user/:display_name/traces/:id/picture" => "traces#picture", :as => "trace_picture" - get "/user/:display_name/traces/:id/icon" => "traces#icon", :as => "trace_icon" + scope "/user/:display_name/traces/:trace_id", :module => :traces do + get "picture" => "pictures#show", :as => "trace_picture" + get "icon" => "icons#show", :as => "trace_icon" + end get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}") get "/traces/tag/:tag" => "traces#index" get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces") @@ -234,20 +248,22 @@ OpenStreetMap::Application.routes.draw do get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss } get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss } get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss } - get "/user/:display_name/diary/comments/:page" => "diary_entries#comments", :page => /[1-9][0-9]*/ - get "/user/:display_name/diary/comments/" => "diary_entries#comments", :as => :diary_comments + get "/user/:display_name/diary/comments/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary/comments") + get "/user/:display_name/diary/comments" => "diary_comments#index", :as => :diary_comments get "/user/:display_name/diary" => "diary_entries#index" get "/diary/:language" => "diary_entries#index" scope "/user/:display_name" do - resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ + resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ do + member do + post :hide, :unhide + end + end end - post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/, :as => :comment_diary_entry - post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry - post "/user/:display_name/diary/:id/unhide" => "diary_entries#unhide", :id => /\d+/, :as => :unhide_diary_entry - post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entries#hidecomment", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment - post "/user/:display_name/diary/:id/unhidecomment/:comment" => "diary_entries#unhidecomment", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/ match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/ + post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry + post "/diary_comments/:comment/hide" => "diary_comments#hide", :comment => /\d+/, :as => :hide_diary_comment + post "/diary_comments/:comment/unhide" => "diary_comments#unhide", :comment => /\d+/, :as => :unhide_diary_comment # user pages resources :users, :path => "user", :param => :display_name, :only => [:show, :destroy] @@ -307,25 +323,13 @@ OpenStreetMap::Application.routes.draw do end resources :user_mutes, :only => [:index] - # oauth admin pages (i.e: for setting up new clients, etc...) - scope "/user/:display_name" do - resources :oauth_clients - end - match "/oauth/revoke" => "oauth#revoke", :via => [:get, :post] - match "/oauth/authorize" => "oauth#authorize", :via => [:get, :post], :as => :authorize - get "/oauth/token" => "oauth#token", :as => :token - match "/oauth/request_token" => "oauth#request_token", :via => [:get, :post], :as => :request_token - match "/oauth/access_token" => "oauth#access_token", :via => [:get, :post], :as => :access_token - get "/oauth/test_request" => "oauth#test_request", :as => :test_request - # roles and banning pages post "/user/:display_name/role/:role/grant" => "user_roles#grant", :as => "grant_role" post "/user/:display_name/role/:role/revoke" => "user_roles#revoke", :as => "revoke_role" get "/user/:display_name/blocks" => "user_blocks#blocks_on", :as => "user_blocks_on" get "/user/:display_name/blocks_by" => "user_blocks#blocks_by", :as => "user_blocks_by" get "/blocks/new/:display_name" => "user_blocks#new", :as => "new_user_block" - resources :user_blocks - match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block" + resources :user_blocks, :except => :new match "/user/:display_name/blocks/revoke_all" => "user_blocks#revoke_all", :via => [:get, :post], :as => "revoke_all_user_blocks" # issues and reports @@ -345,6 +349,7 @@ OpenStreetMap::Application.routes.draw do resources :redactions # errors + match "/400", :to => "errors#bad_request", :via => :all match "/403", :to => "errors#forbidden", :via => :all match "/404", :to => "errors#not_found", :via => :all match "/500", :to => "errors#internal_server_error", :via => :all