Election results in the London Borough of Sutton.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

app.rb 988 B

14 år sedan
14 år sedan
14 år sedan
14 år sedan
14 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. require 'rubygems'
  2. require 'sinatra'
  3. require 'pat'
  4. require 'dm-core'
  5. require 'dm-validations'
  6. require 'dm-timestamps'
  7. require 'lib/models'
  8. DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/db.sqlite3")
  9. DataMapper.auto_upgrade!
  10. get '/' do
  11. @wards = Ward.all
  12. haml :home
  13. end
  14. get '/wards/:id' do
  15. @ward = Ward.get(params[:id])
  16. @candidates = Councilcandidate.all( :ward_id => @ward.id )
  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. haml :wards
  25. end
  26. get '/how-the-election-works' do
  27. haml :election
  28. end
  29. # get '/voting' do
  30. # haml :voting
  31. # end
  32. get '/about' do
  33. @accounts = %w{
  34. adrianshort
  35. mashthestate
  36. openlylocal
  37. openelection
  38. lbsuttonnews
  39. stef
  40. stonecothill
  41. sutmoblib
  42. mysociety
  43. pezholio
  44. stonecotparking
  45. }
  46. haml :about
  47. end