From bf2e2c714066fe9064708552f2e31e64fa0982d3 Mon Sep 17 00:00:00 2001 From: Nick Black Date: Tue, 24 Apr 2007 07:55:19 +0000 Subject: [PATCH 1/1] completed UK postcode search --- app/controllers/geocoder_controller.rb | 9 +++------ app/views/site/index.rhtml | 7 ++----- config/routes.rb | 3 ++- public/stylesheets/site.css | 12 +++++++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 99042414d..7d434f19a 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -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 diff --git a/app/views/site/index.rhtml b/app/views/site/index.rhtml index 35e542699..a066677ea 100644 --- a/app/views/site/index.rhtml +++ b/app/views/site/index.rhtml @@ -7,16 +7,13 @@ <%= submit_tag 'Search' %> <%= end_form_tag %>
-eg SW15 6JH +eg: SW15 6JH
-Essen +eg:Essen
- - - <% lon = params['lon'] || '-0.1' %> <% lat = params['lat'] || '51.5' %> <% zoom = params['zoom'] || '4' %> diff --git a/config/routes.rb b/config/routes.rb index 36cc5df0a..d6e800355 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,8 +75,9 @@ 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' + map.connect ':controller/:id/:action' map.connect ':controller/:action' end diff --git a/public/stylesheets/site.css b/public/stylesheets/site.css index c502a59ff..1a4b8df4c 100644 --- a/public/stylesheets/site.css +++ b/public/stylesheets/site.css @@ -146,7 +146,7 @@ body { #content { - /* width: 700px; */ + /* width: 700px; */ padding: 0; /*padding-left: 1em;*/ margin: 0; @@ -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; @@ -419,5 +421,5 @@ hides rule from IE5-Mac \*/ } input { - border: 1px solid black; + border: 1px solid black; } -- 2.39.5