Restore the duplicate search form in the header

It turns out the duplicate form is used, for the the mobile view.
This commit is contained in:
Tom Hughes 2013-12-16 09:39:54 +00:00
parent 6ff6b2f527
commit dd12e1de63
3 changed files with 7 additions and 3 deletions

View file

@ -229,7 +229,7 @@ $(document).ready(function () {
page.load = function() { page.load = function() {
if (!("autofocus" in document.createElement("input"))) { if (!("autofocus" in document.createElement("input"))) {
$(".search_form input[name=query]").focus(); $("#sidebar .search_form input[name=query]").focus();
} }
return map.getState(); return map.getState();
}; };

View file

@ -1,7 +1,7 @@
<%= form_tag search_path, :class => "search_form" do %> <%= form_tag search_path, :class => "search_form" do %>
<%= submit_tag t('site.search.submit_text') %> <%= submit_tag t('site.search.submit_text') %>
<div class='query_wrapper'> <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') } %> <%= link_to t('site.search.where_am_i'), '#', { :class => "describe_location", :title => t('site.search.where_am_i_title') } %>
</div> </div>
<% end %> <% end %>

View file

@ -16,9 +16,13 @@
<% end %> <% end %>
<% end %> <% end %>
<% content_for :header do %>
<%= render :partial => "layouts/search", :locals => { :autofocus => false } %>
<% end %>
<% content_for :content do %> <% content_for :content do %>
<div id="sidebar"> <div id="sidebar">
<%= render :partial => "layouts/search" %> <%= render :partial => "layouts/search", :locals => { :autofocus => true } %>
<% if STATUS == :database_offline or STATUS == :api_offline %> <% if STATUS == :database_offline or STATUS == :api_offline %>
<p class="error"><%= t 'layouts.osm_offline' %></p> <p class="error"><%= t 'layouts.osm_offline' %></p>