Election results in the London Borough of Sutton.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

14 лет назад
14 лет назад
14 лет назад
14 лет назад
14 лет назад
14 лет назад
14 лет назад
14 лет назад
14 лет назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. require 'rubygems'
  2. require 'sinatra'
  3. require 'haml'
  4. require 'pat'
  5. require 'dm-core'
  6. require 'dm-validations'
  7. require 'dm-timestamps'
  8. require 'lib/models'
  9. get '/' do
  10. haml :home
  11. end
  12. get '/wards/:id' do
  13. @ward = Ward.get(params[:id])
  14. @council_candidates = Councilcandidate.all( :ward_id => @ward.id, :order => [ 'surname' ] )
  15. @parly_candidates = Parliamentcandidate.all( :constituency_id => @ward.constituency.id, :order => [ 'surname' ])
  16. haml :wards
  17. end
  18. get '/wards' do
  19. @postcode = params[:postcode].strip.upcase
  20. # Postcode not found/invalid
  21. # Postcode valid but not in LB Sutton
  22. unless result = Pat.get(@postcode)
  23. redirect '/error'
  24. end
  25. @district_name = result['administrative']['district']['title']
  26. @ward_name = result['administrative']['ward']['title']
  27. @ward = Ward.first( { :name => @ward_name } )
  28. @council_candidates = Councilcandidate.all( :ward_id => @ward.id, :order => [ 'surname' ])
  29. @parly_candidates = Parliamentcandidate.all( :constituency_id => @ward.constituency.id, :order => [ 'surname' ])
  30. haml :wards
  31. end
  32. get '/how-the-council-election-works' do
  33. haml :election
  34. end
  35. # get '/voting' do
  36. # haml :voting
  37. # end
  38. get '/error' do
  39. haml :error
  40. end
  41. get '/about' do
  42. @accounts = %w{
  43. adrianshort
  44. stef
  45. pezholio
  46. countculture
  47. understood
  48. mashthestate
  49. openlylocal
  50. openelection
  51. lbsuttonnews
  52. suttongisteam
  53. stonecothill
  54. sutmoblib
  55. mysociety
  56. }
  57. haml :about
  58. end