module GeocoderHelper
def result_to_html(result)
- html_options = { :class => "set_position" }
+ html_options = { :class => "set_position", :data => {} }
if result[:min_lon] and result[:min_lat] and result[:max_lon] and result[:max_lat]
url = "?minlon=#{result[:min_lon]}&minlat=#{result[:min_lat]}&maxlon=#{result[:max_lon]}&maxlat=#{result[:max_lat]}"
end
result.each do |key,value|
- html_options["data-#{key.to_s.tr('_', '-')}"] = value
+ html_options[:data][key.to_s.tr('_', '-')] = value
end
html = ""
link_to(
image_tag("#{name}.png", :alt => t("user.login.openid_providers.#{name}.alt")),
"#",
- :class => "openid_button", "data-url" => url,
+ :class => "openid_button", :data => { :url => url },
:title => t("user.login.openid_providers.#{name}.title")
)
end
<% else %>
<% content_for :greeting do %>
<% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
-<%= link_to t("layouts.home"), "#", :class => "set_position", "data-lat" => @user.home_lat, "data-lon" => @user.home_lon, "data-zoom" => 15, :title => t("layouts.home_tooltip") %> |
+<%= link_to t("layouts.home"), "#", :class => "set_position", :data => { :lat => @user.home_lat, :lon => @user.home_lon, :zoom => 15 }, :title => t("layouts.home_tooltip") %> |
<% end %>
<% end %>
<% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
<% content_for :greeting do %>
- <%= link_to t("layouts.home"), "#", :class => "set_position", "data-lat" => @user.home_lat, "data-lon" => @user.home_lon, "data-zoom" => 15, :title => t("layouts.home_tooltip") %> |
+ <%= link_to t("layouts.home"), "#", :class => "set_position", :data => { :lat => @user.home_lat, :lon => @user.home_lon, :zoom => 15 }, :title => t("layouts.home_tooltip") %> |
<% end %>
<% end %>