Tidy up generation of UJS data attributes
This commit is contained in:
parent
49b3f8676a
commit
344c5534ee
4 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
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]}"
|
||||
|
@ -9,7 +9,7 @@ module GeocoderHelper
|
|||
end
|
||||
|
||||
result.each do |key,value|
|
||||
html_options["data-#{key.to_s.tr('_', '-')}"] = value
|
||||
html_options[:data][key.to_s.tr('_', '-')] = value
|
||||
end
|
||||
|
||||
html = ""
|
||||
|
|
|
@ -7,7 +7,7 @@ module UserHelper
|
|||
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
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<% 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 %>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% 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 %>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue