1 <script type="text/javascript">
3 function startSearch() {
4 updateSidebar("<%= t 'site.sidebar.search_results' %>", "");
7 function describeLocation() {
8 var args = getArgs($("viewanchor").href);
10 <%= remote_function(:loading => "startSearch()",
11 :url => { :controller => :geocoder, :action => :description },
12 :with => "'lat=' + args['lat'] + '&lon=' + args['lon'] + '&zoom=' + args['zoom']") %>
15 function setSearchViewbox() {
16 <% if params[:action] == 'index' %>
17 var extent = getMapExtent();
19 $("minlon").value = extent.left;
20 $("minlat").value = extent.bottom;
21 $("maxlon").value = extent.right;
22 $("maxlat").value = extent.top;
26 <% if params[:query] %>
27 <%= remote_function(:loading => "startSearch()",
28 :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
33 <% content_for "optionals" do %>
34 <div class="optionalbox">
35 <span class="whereami"><a href="javascript:describeLocation()" title="<%= t 'site.search.where_am_i_title' %>"><%= t 'site.search.where_am_i' %></a></span>
36 <h1><%= t 'site.search.search' %></h1>
37 <div class="search_form">
38 <div id="search_field">
39 <% form_remote_tag(:before => "setSearchViewbox()",
40 :loading => "startSearch()",
41 :complete => "endSearch()",
42 :url => { :controller => :geocoder, :action => :search },
43 :html => { :method => "get", :action => url_for(:action => "index") }) do %>
44 <%= text_field_tag :query, h(params[:query]) %>
45 <% if params[:action] == 'index' %>
46 <%= hidden_field_tag :minlon %>
47 <%= hidden_field_tag :minlat %>
48 <%= hidden_field_tag :maxlon %>
49 <%= hidden_field_tag :maxlat %>
51 <%= submit_tag t('site.search.submit_text') %>
55 <p class="search_help">
56 <%= t 'site.search.search_help' %>