From: Martin Raifer Date: Sun, 18 May 2014 15:07:31 +0000 (+0200) Subject: Instruct iD to load gpx file X-Git-Tag: live~4954 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/1eab367de5950af5396756dbf09cc9bd3edc3b8f?hp=5da273027f53cf4413aa385ea41ffacee5acf039 Instruct iD to load gpx file When one clicks on the edit link of an uploaded GPX file, this instructs the iD editor to load the respective GPX data from the appropriate URL. See https://github.com/openstreetmap/iD/issues/970#issuecomment-43439476. --- diff --git a/app/views/site/_id.html.erb b/app/views/site/_id.html.erb index f88942669..db611f428 100644 --- a/app/views/site/_id.html.erb +++ b/app/views/site/_id.html.erb @@ -26,9 +26,13 @@ params.background = hashParams.background; } +<% if params[:gpx] -%> + params.gpx = '<%= trace_data_url(params[:gpx]) %>'; +<% else -%> if (hashParams.gpx) { params.gpx = hashParams.gpx; } +<% end -%> $('#id-embed').attr('src', '<%= id_url :locale => params[:locale] %>#' + querystring.stringify(params)); diff --git a/config/routes.rb b/config/routes.rb index e9f593d92..3357f911d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -194,7 +194,7 @@ OpenStreetMap::Application.routes.draw do match '/traces/mine/page/:page' => 'trace#mine', :via => :get match '/traces/mine' => 'trace#mine', :via => :get match '/trace/create' => 'trace#create', :via => [:get, :post] - match '/trace/:id/data' => 'trace#data', :via => :get, :id => /\d+/ + match '/trace/:id/data' => 'trace#data', :via => :get, :id => /\d+/, :as => "trace_data" match '/trace/:id/edit' => 'trace#edit', :via => [:get, :post, :patch], :id => /\d+/, :as => "trace_edit" match '/trace/:id/delete' => 'trace#delete', :via => :post, :id => /\d+/