It turns out the duplicate form is used, for the the mobile view.
page.load = function() {
if (!("autofocus" in document.createElement("input"))) {
- $(".search_form input[name=query]").focus();
+ $("#sidebar .search_form input[name=query]").focus();
}
return map.getState();
};
<%= form_tag search_path, :class => "search_form" do %>
<%= submit_tag t('site.search.submit_text') %>
<div class='query_wrapper'>
- <input type="text" name="query" value="<%= params[:query] %>" placeholder="<%= t('site.search.search') %>" autofocus>
+ <%= text_field_tag "query", params[:query], :placeholder => t("site.search.search"), :autofocus => autofocus %>
<%= link_to t('site.search.where_am_i'), '#', { :class => "describe_location", :title => t('site.search.where_am_i_title') } %>
</div>
<% end %>
<% end %>
<% end %>
+<% content_for :header do %>
+ <%= render :partial => "layouts/search", :locals => { :autofocus => false } %>
+<% end %>
+
<% content_for :content do %>
<div id="sidebar">
- <%= render :partial => "layouts/search" %>
+ <%= render :partial => "layouts/search", :locals => { :autofocus => true } %>
<% if STATUS == :database_offline or STATUS == :api_offline %>
<p class="error"><%= t 'layouts.osm_offline' %></p>