X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e376f3c00980a8026445c21d653fa5119f23a72a..d9d625f65186e846d12431cefede8999f65ca4e5:/app/controllers/geocoder_controller.rb diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 4ed94b649..27e7cbf3e 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -21,13 +21,13 @@ class GeocoderController < ApplicationController results_count = count_results(results) render :update do |page| - page.replace_html :search_results_content, :partial => 'results', :object => results + page.replace_html :sidebar_content, :partial => 'results', :object => results if results_count == 1 position = results.collect { |s| s[:results] }.compact.flatten[0] page.call "setPosition", position[:lat], position[:lon], position[:zoom] else - page.call "openSearchResults" + page.call "openSidebar" end end end @@ -44,8 +44,8 @@ class GeocoderController < ApplicationController results.push description_geonames(lat, lon) render :update do |page| - page.replace_html :search_results_content, :partial => 'results', :object => results - page.call "openSearchResults" + page.replace_html :sidebar_content, :partial => 'results', :object => results + page.call "openSidebar" end end @@ -185,7 +185,7 @@ private name = named.attributes["name"].to_s description = named.elements["description"].to_s distance = format_distance(place.attributes["approxdistance"].to_i) - direction = format_direction(360 - place.attributes["direction"].to_i) + direction = format_direction((place.attributes["direction"].to_i - 180) % 360) prefix = "#{distance} #{direction} of #{type} " results.push({:lat => lat, :lon => lon, :zoom => zoom, :prefix => prefix.capitalize, :name => name,