|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- require 'rubygems'
- require 'sinatra'
- require 'pat'
- require 'dm-core'
- require 'dm-validations'
- require 'dm-timestamps'
- require 'lib/models'
-
- DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/db.sqlite3")
- DataMapper.auto_upgrade!
-
- get '/' do
- @wards = Ward.all
- haml :home
- end
-
- get '/wards/:id' do
- @ward = Ward.get(params[:id])
- @candidates = Councilcandidate.all( :ward_id => @ward.id )
- haml :wards
- end
-
- get '/wards' do
- @postcode = params[:postcode].strip.upcase
- result = Pat.get(@postcode)
- @district_name = result['administrative']['district']['title']
- @ward_name = result['administrative']['ward']['title']
- haml :wards
- end
-
- get '/how-the-election-works' do
- haml :election
- end
-
- # get '/voting' do
- # haml :voting
- # end
-
- get '/about' do
- @accounts = %w{
- adrianshort
- mashthestate
- openlylocal
- openelection
- lbsuttonnews
- stef
- stonecothill
- sutmoblib
- mysociety
- pezholio
- stonecotparking
- }
- haml :about
- end
|