Redirect ?node=n and similar to browse pages

This commit is contained in:
John Firebaugh 2013-09-28 15:02:36 -07:00
parent b30983f02b
commit e838dddf12
2 changed files with 12 additions and 4 deletions

View 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

View 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"