]> git.openstreetmap.org Git - rails.git/blob - app/helpers/geocoder_helper.rb
Add support for CSS based control of user specific components
[rails.git] / app / helpers / geocoder_helper.rb
1 module GeocoderHelper
2   def result_to_html(result)
3     html_options = {}
4     #html_options[:title] = strip_tags(result[:description]) if result[:description]
5     if result[:min_lon] and result[:min_lat] and result[:max_lon] and result[:max_lat]
6       html_options[:href] = "?minlon=#{result[:min_lon]}&minlat=#{result[:min_lat]}&maxlon=#{result[:max_lon]}&maxlat=#{result[:max_lat]}"
7     else
8       html_options[:href] = "?mlat=#{result[:lat]}&mlon=#{result[:lon]}&zoom=#{result[:zoom]}"
9     end
10
11     html = ""
12     html << result[:prefix] if result[:prefix]
13     html << " " if result[:prefix] and result[:name]
14
15     if result[:min_lon] and result[:min_lat] and result[:max_lon] and result[:max_lat]
16       html << link_to_function(result[:name],"setPosition(#{result[:lat]}, #{result[:lon]}, null, #{result[:min_lon]}, #{result[:min_lat]}, #{result[:max_lon]}, #{result[:max_lat]})", html_options)  if result[:name]
17     else
18       html << link_to_function(result[:name],"setPosition(#{result[:lat]}, #{result[:lon]}, #{result[:zoom]})", html_options)  if result[:name]
19     end
20
21     html << result[:suffix] if result[:suffix]
22     return html
23   end
24 end