completed UK postcode search
This commit is contained in:
parent
a926189c7f
commit
bf2e2c7140
4 changed files with 14 additions and 17 deletions
|
@ -4,15 +4,12 @@ class GeocoderController < ApplicationController
|
|||
require 'net/http'
|
||||
require 'rexml/document'
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :require_user
|
||||
|
||||
def search
|
||||
res_hash = {}
|
||||
@postcode_arr = []
|
||||
@res_ary = []
|
||||
|
||||
if params[:query][:postcode] != ""
|
||||
if params[:query][:postcode]
|
||||
postcode = params[:query][:postcode]
|
||||
if postcode.match(/(^\d{5}$)|(^\d{5}-\d{4}$)/)
|
||||
#its a zip code - do something
|
||||
|
@ -42,11 +39,11 @@ class GeocoderController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
redirect_to :controller => 'geocoder', :action => 'results'
|
||||
redirect_to :controller => 'geocoder', :action => 'results', :params => @res_ary
|
||||
end
|
||||
end
|
||||
|
||||
def result
|
||||
|
||||
@res = :params[@res_ary]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,16 +7,13 @@
|
|||
<%= submit_tag 'Search' %>
|
||||
<%= end_form_tag %>
|
||||
<div id="postcode-helper">
|
||||
eg SW15 6JH
|
||||
eg: SW15 6JH
|
||||
</div>
|
||||
<div id="placename-helper">
|
||||
Essen
|
||||
eg:Essen
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<% lon = params['lon'] || '-0.1' %>
|
||||
<% lat = params['lat'] || '51.5' %>
|
||||
<% zoom = params['zoom'] || '4' %>
|
||||
|
|
|
@ -75,6 +75,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
|
||||
# geocoder
|
||||
map.connect 'geocoder/search/', :controller => 'geocoder', :action => 'search'
|
||||
map.connect 'geocoder/results/', :controller => 'geocoder', :action => 'results'
|
||||
|
||||
# fall through
|
||||
map.connect ':controller/:id/:action'
|
||||
|
|
|
@ -292,17 +292,19 @@ hides rule from IE5-Mac \*/
|
|||
}
|
||||
|
||||
#placename-helper{
|
||||
font-size: 10px;
|
||||
font-size: 9px;
|
||||
position:relative; bottom:36px; left: 470px;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
#postcode-helper{
|
||||
font-size: 10px;
|
||||
position:relative; bottom:16px; left: 180px;
|
||||
font-size: 9px;
|
||||
position:relative; bottom:17px; left: 180px;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.gpxsummary {
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue