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
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
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,