]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/2444'
authorTom Hughes <tom@compton.nu>
Mon, 30 Dec 2019 22:34:24 +0000 (22:34 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 30 Dec 2019 22:34:24 +0000 (22:34 +0000)
1  2 
app/controllers/site_controller.rb
config/routes.rb

index 3a69eed120e1299ed90287c2f15ae96cb0515823,f57bb7c256cb3c27af0f9716da3df8aaf86b484c..1fc916e7f8436c3f3a22d6742c5ffc1395ee3932
@@@ -77,30 -77,26 +77,30 @@@ class SiteController < ApplicationContr
        )
      end
  
 -    if params[:node]
 -      bbox = Node.find(params[:node]).bbox.to_unscaled
 -      @lat = bbox.centre_lat
 -      @lon = bbox.centre_lon
 -      @zoom = 18
 -    elsif params[:way]
 -      bbox = Way.find(params[:way]).bbox.to_unscaled
 -      @lat = bbox.centre_lat
 -      @lon = bbox.centre_lon
 -      @zoom = 17
 -    elsif params[:note]
 -      note = Note.find(params[:note])
 -      @lat = note.lat
 -      @lon = note.lon
 -      @zoom = 17
 -    elsif params[:gpx] && current_user
 -      trace = Trace.visible_to(current_user).find(params[:gpx])
 -      @lat = trace.latitude
 -      @lon = trace.longitude
 -      @zoom = 16
 +    begin
 +      if params[:node]
 +        bbox = Node.visible.find(params[:node]).bbox.to_unscaled
 +        @lat = bbox.centre_lat
 +        @lon = bbox.centre_lon
 +        @zoom = 18
 +      elsif params[:way]
 +        bbox = Way.visible.find(params[:way]).bbox.to_unscaled
 +        @lat = bbox.centre_lat
 +        @lon = bbox.centre_lon
 +        @zoom = 17
 +      elsif params[:note]
 +        note = Note.visible.find(params[:note])
 +        @lat = note.lat
 +        @lon = note.lon
 +        @zoom = 17
 +      elsif params[:gpx] && current_user
 +        trace = Trace.visible_to(current_user).find(params[:gpx])
 +        @lat = trace.latitude
 +        @lon = trace.longitude
 +        @zoom = 16
 +      end
 +    rescue ActiveRecord::RecordNotFound
 +      # don't try and derive a location from a missing/deleted object
      end
    end
  
  
    def help; end
  
-   def about; end
+   def about
+     @locale = params[:about_locale] || I18n.locale
+   end
  
    def export; end
  
diff --combined config/routes.rb
index 992197814ee15b2dad1c7a8bb07e9f14216f4ac7,6764335d6635bb6508d2d6f113a7330fda39cc80..37ffa2d9a9acde4bb88e64458f1ea4e909d9a7da
@@@ -12,6 -12,7 +12,6 @@@ OpenStreetMap::Application.routes.draw 
      put "changeset/create" => "api/changesets#create"
      post "changeset/:id/upload" => "api/changesets#upload", :id => /\d+/
      get "changeset/:id/download" => "api/changesets#download", :as => :changeset_download, :id => /\d+/
 -    post "changeset/:id/expand_bbox" => "api/changesets#expand_bbox", :id => /\d+/
      get "changeset/:id" => "api/changesets#show", :as => :changeset_show, :id => /\d+/
      post "changeset/:id/subscribe" => "api/changesets#subscribe", :as => :changeset_subscribe, :id => /\d+/
      post "changeset/:id/unsubscribe" => "api/changesets#unsubscribe", :as => :changeset_unsubscribe, :id => /\d+/
    get "/welcome" => "site#welcome"
    get "/fixthemap" => "site#fixthemap"
    get "/help" => "site#help"
+   get "/about/:about_locale" => "site#about"
    get "/about" => "site#about"
    get "/history" => "changesets#index"
    get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
    get "/trace/create", :to => redirect(:path => "/traces/new")
    get "/trace/:id/data" => "traces#data", :id => /\d+/, :as => "trace_data"
    get "/trace/:id/edit", :to => redirect(:path => "/traces/%{id}/edit")
 -  post "/trace/:id/delete" => "traces#delete", :id => /\d+/
  
    # diary pages
    resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do