]> git.openstreetmap.org Git - rails.git/commitdiff
Redirect ?node=n and similar to browse pages
authorJohn Firebaugh <john.firebaugh@gmail.com>
Sat, 28 Sep 2013 22:02:36 +0000 (15:02 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Sun, 13 Oct 2013 21:45:58 +0000 (14:45 -0700)
app/controllers/site_controller.rb
config/routes.rb

index 4945aaa4ff2793457ff0caccd2a20afd321cb411..32a0f8cb5214619c6975842dfd500fe32bc14815 100644 (file)
@@ -97,7 +97,15 @@ class SiteController < ApplicationController
       anchor << "layers=N"
     end
 
-    if anchor.present?
+    if params[:node]
+      redirect_to node_path(params[:node])
+    elsif params[:way]
+      redirect_to way_path(params[:way])
+    elsif params[:relation]
+      redirect_to relation_path(params[:relation])
+    elsif params[:note]
+      redirect_to browse_note_path(params[:note])
+    elsif anchor.present?
       redirect_to params.merge(:anchor => anchor.join('&'))
     end
   end
index 4351b65ce98ad7fd80647d01db7b2b31925fadab..a1321d7f251893feacc3b4866b65d32b6f0770e7 100644 (file)
@@ -103,11 +103,11 @@ OpenStreetMap::Application.routes.draw do
 
   # Data browsing
   match '/browse/start' => 'browse#start', :via => :get
-  match '/browse/way/:id' => 'browse#way', :via => :get, :id => /\d+/
+  match '/browse/way/:id' => 'browse#way', :via => :get, :id => /\d+/, :as => :way
   match '/browse/way/:id/history' => 'browse#way_history', :via => :get, :id => /\d+/
-  match '/browse/node/:id' => 'browse#node', :via => :get, :id => /\d+/
+  match '/browse/node/:id' => 'browse#node', :via => :get, :id => /\d+/, :as => :node
   match '/browse/node/:id/history' => 'browse#node_history', :via => :get, :id => /\d+/
-  match '/browse/relation/:id' => 'browse#relation', :via => :get, :id => /\d+/
+  match '/browse/relation/:id' => 'browse#relation', :via => :get, :id => /\d+/, :as => :relation
   match '/browse/relation/:id/history' => 'browse#relation_history', :via => :get, :id => /\d+/
   match '/browse/changeset/:id' => 'browse#changeset', :via => :get, :as => :changeset, :id => /\d+/
   match '/browse/note/:id' => 'browse#note', :via => :get, :id => /\d+/, :as => "browse_note"