Election results in the London Borough of Sutton.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

14 anni fa
14 anni fa
14 anni fa
14 anni fa
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. require 'rubygems'
  2. require 'sinatra'
  3. require 'sinatra-helpers/haml/partials'
  4. require 'haml'
  5. require 'lib/models'
  6. get '/' do
  7. if params[:postcode]
  8. @postcode = params[:postcode].strip.upcase
  9. unless result = Postcode.finder(@postcode)
  10. # Invalid postcode
  11. redirect '/error'
  12. end
  13. # Postcode valid but not in LB Sutton
  14. if result.district_code != "00BF"
  15. redirect '/aliens'
  16. end
  17. # Postcode in LB Sutton
  18. @ward = Ward.first( :ons_id => result.ward_code )
  19. redirect "/wards/#{@ward.slug}/postcode/#{@postcode}"
  20. end
  21. haml :home
  22. end
  23. get '/wards/:slug/postcode/:postcode/?' do
  24. @ward = Ward.first(:slug => params[:slug])
  25. @postcode = params[:postcode]
  26. haml :wards
  27. end
  28. get '/wards/:slug/?' do
  29. @ward = Ward.first(:slug => params[:slug])
  30. haml :wards
  31. end
  32. get '/wards/?' do
  33. @wards = Ward.all
  34. haml :wardlist
  35. end
  36. get '/how-the-council-election-works' do
  37. haml :election
  38. end
  39. get '/how-the-parliament-election-works' do
  40. haml :parliament
  41. end
  42. # get '/voting' do
  43. # haml :voting
  44. # end
  45. get '/error' do
  46. haml :error
  47. end
  48. get '/about' do
  49. haml :about
  50. end
  51. get '/aliens' do
  52. haml :aliens
  53. end