function initializeSearch(map) {
$("#search_form").submit(submitSearch);
+ $("#describe_location").click(describeLocation);
if ($("#query").val()) {
$("#search_form").submit();
map.addObject(data, { zoom: false, style: { opacity: 0.2, fill: false } });
}
}
+
+ function describeLocation(e) {
+ e.preventDefault();
+
+ var center = map.getCenter(),
+ zoom = map.getZoom();
+
+ $("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
+ $("#sidebar_content").load($(this).attr("href"), {
+ lat: center.lat,
+ lon: center.lng,
+ zoom: zoom
+ }, openSidebar);
+ }
}
-<script type="text/javascript">
-<!--
- function describeLocation() {
- var args = querystring.parse($("#viewanchor").attr("href").split('?')[1]);
-
- $("#sidebar_title").html("<%= t 'site.sidebar.search_results' %>");
- $("#sidebar_content").load("<%= url_for :controller => :geocoder, :action => :description %>", {
- lat: args["lat"],
- lon: args["lon"],
- zoom: args["zoom"]
- }, openSidebar);
- }
-// -->
-</script>
-
<% content_for :optionals do %>
<div class="optionalbox">
<div class="search_container">
</div>
<p class='search_help deemphasize'>
<%= raw(t 'site.search.search_help') %>
- <span class="whereami"><a href="javascript:describeLocation()" title="<%= t 'site.search.where_am_i_title' %>"><%= t 'site.search.where_am_i' %></a></span>
+ <%= link_to t('site.search.where_am_i'), { :controller => :geocoder, :action => :description }, { :id => "describe_location", :title => t('site.search.where_am_i_title') } %>
</p>
</div>
<% end %>