1 <script type="text/javascript">
3 function describeLocation() {
4 var args = getArgs($("viewanchor").href);
6 <%= remote_function(:loading => "startSearch()",
7 :url => { :controller => :geocoder, :action => :description },
8 :with => "'lat=' + args['lat'] + '&lon=' + args['lon'] + '&zoom=' + args['zoom']") %>
11 function setSearchViewbox() {
12 <% if params[:action] == 'index' %>
13 var extent = getMapExtent();
15 var minlon = document.createElement("input");
16 minlon.type = "hidden";
18 minlon.name = "minlon";
19 minlon.value = extent.left;
20 $("search_form").appendChild(minlon);
22 var minlat = document.createElement("input");
23 minlat.type = "hidden";
25 minlat.name = "minlat";
26 minlat.value = extent.bottom;
27 $("search_form").appendChild(minlat);
29 var maxlon = document.createElement("input");
30 maxlon.type = "hidden";
32 maxlon.name = "maxlon";
33 maxlon.value = extent.left;
34 $("search_form").appendChild(maxlon);
36 var maxlat = document.createElement("input");
37 maxlat.type = "hidden";
39 maxlat.name = "maxlat";
40 maxlat.value = extent.bottom;
41 $("search_form").appendChild(maxlat);
45 function startSearch() {
46 updateSidebar("<%= t 'site.sidebar.search_results' %>", "");
49 function endSearch() {
50 <% if params[:action] == 'index' %>
58 <% if params[:query] %>
59 <%= remote_function(:loading => "startSearch()",
60 :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
65 <% content_for "optionals" do %>
66 <div class="optionalbox">
67 <span class="whereami"><a href="javascript:describeLocation()" title="<%= t 'site.search.where_am_i_title' %>"><%= t 'site.search.where_am_i' %></a></span>
68 <h1><%= t 'site.search.search' %></h1>
69 <div class="search_container">
70 <div id="search_field">
71 <% form_remote_tag(:before => "setSearchViewbox()",
72 :loading => "startSearch()",
73 :complete => "endSearch()",
74 :url => { :controller => :geocoder, :action => :search },
75 :html => { :id => "search_form", :method => "get", :action => url_for(:action => "index") }) do %>
76 <%= text_field_tag :query, h(params[:query]), :tabindex => "1" %>
77 <%= submit_tag t('site.search.submit_text') %>
81 <p class="search_help">
82 <%= t 'site.search.search_help' %>