Election results in the London Borough of Sutton.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

app.rb 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # @wards = Ward.all( :order => ['name' ] )
  11. haml :home
  12. end
  13. get '/wards/:id' do
  14. @ward = Ward.get(params[:id])
  15. @council_candidates = Councilcandidate.all( :ward_id => @ward.id, :order => 'surname' )
  16. @parly_candidates = Parliamentcandidate.all( :constituency_id => @ward.constituency.id, :order => 'surname')
  17. haml :wards
  18. end
  19. get '/wards' do
  20. @postcode = params[:postcode].strip.upcase
  21. result = Pat.get(@postcode)
  22. @district_name = result['administrative']['district']['title']
  23. @ward_name = result['administrative']['ward']['title']
  24. @ward = Ward.first( { :name => @ward_name } )
  25. @council_candidates = Councilcandidate.all( :ward_id => @ward.id, :order => 'surname')
  26. @parly_candidates = Parliamentcandidate.all( :constituency_id => @ward.constituency.id, :order => 'surname')
  27. haml :wards
  28. end
  29. get '/how-the-council-election-works' do
  30. haml :election
  31. end
  32. # get '/voting' do
  33. # haml :voting
  34. # end
  35. get '/about' do
  36. @accounts = %w{
  37. adrianshort
  38. stef
  39. pezholio
  40. countculture
  41. understood
  42. mashthestate
  43. openlylocal
  44. openelection
  45. lbsuttonnews
  46. suttongisteam
  47. stonecothill
  48. sutmoblib
  49. mysociety
  50. }
  51. haml :about
  52. end