ソースを参照

Text improvements

tags/last-sinatra-version
Adrian Short 16年前
コミット
afd45278bd
7個のファイルの変更72行の追加28行の削除
  1. +7
    -8
      app.rb
  2. +4
    -1
      lib/models.rb
  3. +5
    -0
      public/style.css
  4. +1
    -1
      views/about.haml
  5. +14
    -3
      views/home.haml
  6. +2
    -2
      views/layout.haml
  7. +39
    -13
      views/wards.haml

+ 7
- 8
app.rb ファイルの表示

@@ -6,11 +6,8 @@ require 'dm-validations'
require 'dm-timestamps' require 'dm-timestamps'
require 'lib/models' require 'lib/models'


DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/db.sqlite3")
DataMapper.auto_upgrade!

get '/' do get '/' do
@wards = Ward.all( :order => ['name'] )
# @wards = Ward.all( :order => ['name' ] )
haml :home haml :home
end end


@@ -30,7 +27,7 @@ get '/wards' do
haml :wards haml :wards
end end


get '/how-the-election-works' do
get '/how-the-council-election-works' do
haml :election haml :election
end end


@@ -41,16 +38,18 @@ end
get '/about' do get '/about' do
@accounts = %w{ @accounts = %w{
adrianshort adrianshort
stef
pezholio
countculture
understood
mashthestate mashthestate
openlylocal openlylocal
openelection openelection
lbsuttonnews lbsuttonnews
stef
suttongisteam
stonecothill stonecothill
sutmoblib sutmoblib
mysociety mysociety
pezholio
stonecotparking
} }
haml :about haml :about
end end

+ 4
- 1
lib/models.rb ファイルの表示

@@ -55,4 +55,7 @@ class Constituency
property :name, String, :required => true property :name, String, :required => true
has n, :wards has n, :wards
end
end

DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/db.sqlite3")
DataMapper.auto_upgrade!

+ 5
- 0
public/style.css ファイルの表示

@@ -83,4 +83,9 @@ h1
.candidate_name .candidate_name
{ {
font-size: 150%; font-size: 150%;
}

.highlight
{
background-color: yellow;
} }

+ 1
- 1
views/about.haml ファイルの表示

@@ -10,7 +10,7 @@
The code for this website is open source and managed on Github. It is hosted by Heroku. The code for this website is open source and managed on Github. It is hosted by Heroku.


%p %p
The candidates' data comes from Sutton Council.
The candidates' data comes from Sutton Council who also provided information on council wards and parliamentary constituencies.
%p %p
The postcode lookup is done by UK Postcodes using open data from Ordnance Survey Code-Point Open enhanced by MySociety. I use the Ruby Pat gem to access the postcodes API. The postcode lookup is done by UK Postcodes using open data from Ordnance Survey Code-Point Open enhanced by MySociety. I use the Ruby Pat gem to access the postcodes API.


+ 14
- 3
views/home.haml ファイルの表示

@@ -1,6 +1,18 @@
-# %h2 One day. Two elections in Sutton.
%h1 One day. Two elections in Sutton.


%h2 Who are my local candidates in the Sutton Council elections on 6 May?
%p
On 6 May you can vote to
%strong
choose your local MP
and help to decide the next government of the country.

%p
And you can also
%strong
elect your local councillors
and help to decide who runs Sutton Council.

%p Who you can vote for depends on where you live. You can find your local candidates and get more information on how the elections work here.


%form{ :method => 'get', :action => '/wards' } %form{ :method => 'get', :action => '/wards' }
%label{ :for => "postcode" } My postcode is %label{ :for => "postcode" } My postcode is
@@ -8,7 +20,6 @@
%input{ :type => 'submit', :value => "Find it" } %input{ :type => 'submit', :value => "Find it" }


-# -#

%h2 Council Wards %h2 Council Wards


- for ward in @wards - for ward in @wards


+ 2
- 2
views/layout.haml ファイルの表示

@@ -1,7 +1,7 @@
!!! !!!
%html %html
%head %head
%title Sutton Council Elections 2010
%title Sutton Elections 6 May 2010
%link{ :rel => 'stylesheet', :type => 'text/css', :href => '/style.css' } %link{ :rel => 'stylesheet', :type => 'text/css', :href => '/style.css' }
%body %body
#header #header
@@ -10,7 +10,7 @@
= yield = yield
#footer #footer
%p %p
%a{ :href => '/how-the-election-works' } How the council election works
%a{ :href => '/how-the-council-election-works' } How the council election works
-# -#
%p %p
%a{ :href => '/voting' } How to vote %a{ :href => '/voting' } How to vote


+ 39
- 13
views/wards.haml ファイルの表示

@@ -10,18 +10,44 @@
Ward Ward


%h2 %h2
Your candidates for
= @ward.constituency.name = @ward.constituency.name
Constituency
member of parliament
%p
You can vote for
%strong
ONE
of these people to become your next MP.
%p.highlight
This list of candidates may be incomplete as people have until
%strong
20 April
to decide whether they want to stand for election as the
= @ward.constituency.name
MP.
%h2
Your council candidates in
= @ward.name
Ward


#candidates
%h2
Council candidates in
= @ward.name
- for candidate in @candidates
%p
%span.candidate_name
= candidate.forenames
= candidate.surname
%br
= candidate.party.name
%p
You can vote for
%strong
THREE
of these people to become your local councillors.
%p
Find out more about
%a{ :href => '/how-the-council-election-works' } how the council election works.
- for candidate in @candidates
%p
%span.candidate_name
= candidate.forenames
= candidate.surname
%br
= candidate.party.name

読み込み中…
キャンセル
保存