|
@@ -25,10 +25,18 @@ get '/wards' do |
|
|
# Postcode not found/invalid |
|
|
# Postcode not found/invalid |
|
|
# Postcode valid but not in LB Sutton |
|
|
# Postcode valid but not in LB Sutton |
|
|
|
|
|
|
|
|
unless result = Pat.get(@postcode) |
|
|
|
|
|
|
|
|
result = Pat.get(@postcode) |
|
|
|
|
|
|
|
|
|
|
|
if result.code == 404 |
|
|
redirect '/error' |
|
|
redirect '/error' |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
@district_name = result['administrative']['district']['title'] |
|
|
@district_name = result['administrative']['district']['title'] |
|
|
|
|
|
|
|
|
|
|
|
if @district_name != "Sutton London Borough Council" |
|
|
|
|
|
redirect '/aliens' |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ward_name = result['administrative']['ward']['title'] |
|
|
@ward_name = result['administrative']['ward']['title'] |
|
|
@ward = Ward.first( { :name => @ward_name } ) |
|
|
@ward = Ward.first( { :name => @ward_name } ) |
|
|
@council_candidates = Councilcandidate.all( :ward_id => @ward.id, :order => [ 'surname' ]) |
|
|
@council_candidates = Councilcandidate.all( :ward_id => @ward.id, :order => [ 'surname' ]) |
|
@@ -55,3 +63,7 @@ end |
|
|
get '/about' do |
|
|
get '/about' do |
|
|
haml :about |
|
|
haml :about |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
get '/aliens' do |
|
|
|
|
|
haml :aliens |
|
|
|
|
|
end |