]> git.openstreetmap.org Git - rails.git/blobdiff - config/routes.rb
Refactor diary entries to use create and update methods
[rails.git] / config / routes.rb
index 1989325830543c08d93e3504b7e68022de7b8eb0..12a2828184b617045c3d46f152b6926a5c19ac97 100644 (file)
@@ -216,7 +216,7 @@ OpenStreetMap::Application.routes.draw do
   post "/trace/:id/delete" => "traces#delete", :id => /\d+/
 
   # diary pages
-  match "/diary/new" => "diary_entries#new", :via => [:get, :post]
+  resources :diary_entries, :path => "diary", :only => [:new, :create]
   get "/diary/friends" => "diary_entries#index", :friends => true, :as => "friend_diaries"
   get "/diary/nearby" => "diary_entries#index", :nearby => true, :as => "nearby_diaries"
   get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
@@ -227,9 +227,10 @@ OpenStreetMap::Application.routes.draw do
   get "/user/:display_name/diary" => "diary_entries#index"
   get "/diary/:language" => "diary_entries#index"
   get "/diary" => "diary_entries#index"
-  get "/user/:display_name/diary/:id" => "diary_entries#show", :id => /\d+/, :as => :diary_entry
+  scope "/user/:display_name" do
+    resources :diary_entries, :path => "diary", :only => [:edit, :update, :show]
+  end
   post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/
-  match "/user/:display_name/diary/:id/edit" => "diary_entries#edit", :via => [:get, :post], :id => /\d+/
   post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_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/subscribe" => "diary_entries#subscribe", :as => :diary_entry_subscribe, :id => /\d+/