Ver a proveniência

Added TypeKit fonts. Text and layout changes.

tags/last-sinatra-version
Adrian Short há 14 anos
ascendente
cometimento
1c0fc5e1ea
6 ficheiros alterados com 70 adições e 29 eliminações
  1. +11
    -2
      app.rb
  2. +34
    -8
      public/style.css
  3. +9
    -7
      views/about.haml
  4. +2
    -10
      views/home.haml
  5. +4
    -0
      views/layout.haml
  6. +10
    -2
      views/wards.haml

+ 11
- 2
app.rb Ver ficheiro

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

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

@@ -21,7 +20,13 @@ end

get '/wards' do
@postcode = params[:postcode].strip.upcase
result = Pat.get(@postcode)
# Postcode not found/invalid
# Postcode valid but not in LB Sutton
unless result = Pat.get(@postcode)
redirect '/error'
end
@district_name = result['administrative']['district']['title']
@ward_name = result['administrative']['ward']['title']
@ward = Ward.first( { :name => @ward_name } )
@@ -38,6 +43,10 @@ end
# haml :voting
# end

get '/error' do
haml :error
end

get '/about' do
@accounts = %w{
adrianshort


+ 34
- 8
public/style.css Ver ficheiro

@@ -1,9 +1,10 @@
body
{
background-color: #fffeda;
background-color: #fff;
color: #555;
font-family: Helvetica, Arial, sans-serif;
width: 600px;
margin: 60px auto;
margin: 70px auto;
line-height: 1.5em;
}
@@ -31,32 +32,36 @@ input.postcode

#footer
{
font-size: 90%;
font-size: 100%;
background-color: #fff;
}

.credit
{
text-align: right;
font-size: 80%;
}

a, a:visited
{
background-color: #e0ffd4;
padding: 2px 5px;
background-color: #333;
color: #fff;
color: #111;
text-decoration: none;
}

a:hover
{
background-color: #fff;
color: #333;
background-color: #4f4f4f;
color: #e0ffd4;
}

h2
{
margin-top: 50px;
line-height: 1.5em;
font-weight: bold;
color: #000;
}

form
@@ -66,9 +71,16 @@ form

a.date
{
font-size: 600%;
font-size: 610%;
font-weight: bold;
padding: 30px 30px;
background-color: red;
display: none;
position: absolute;
left: 0;
top: 1000;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
}

#header
@@ -80,14 +92,28 @@ h1
{
margin-top: 50px;
line-height: 1.5em;
font-weight: bold;
color: #000;
}

.candidate_name
{
font-size: 150%;
font-weight: bold;
}

.candidate_party
{
color: #999;
}

.highlight
{
background-color: yellow;
padding: 5px;
}

strong
{
color: #000;
}

+ 9
- 7
views/about.haml Ver ficheiro

@@ -1,7 +1,7 @@
%h1 About this website

%p
This website was designed by
This website was designed and written by
%a{ :href => 'http://adrianshort.co.uk' }> Adrian Short
\.
You can contact me by email at
@@ -23,9 +23,11 @@
%p
This site is written in Ruby using the Sinatra framework. The HTML templates use Haml. The database is sqlite for development and postgresql for production, abstracted through DataMapper. Source control and deployment is done with Git.

%h2 #followfooter

%ul
- for account in @accounts
%li
%a{ :href => "http://twitter.com/#{account}" }@#{account}
-#
%h2 #followfooter
%ul
- for account in @accounts
%li
%a{ :href => "http://twitter.com/#{account}" }@#{account}

+ 2
- 10
views/home.haml Ver ficheiro

@@ -1,7 +1,7 @@
%h1
Vote for your MP and councillors
%br
in Sutton
in Sutton on 6 May

%p
On 6 May you can vote to
@@ -20,12 +20,4 @@
%form{ :method => 'get', :action => '/wards' }
%label{ :for => "postcode" } My postcode is
%input{ :type => 'text', :name => 'postcode', :value => 'SM1 1EA', :size => 8, :maxlength => 8 }
%input{ :type => 'submit', :value => "Find it" }

-#
%h2 Council Wards

- for ward in @wards
%p
%a{ :href => "/wards/#{ward.id.to_s}" }
= ward.name
%input{ :type => 'submit', :value => "Find it" }

+ 4
- 0
views/layout.haml Ver ficheiro

@@ -4,12 +4,16 @@
%head
%title Sutton Elections 6 May 2010
%link{ :rel => 'stylesheet', :type => 'text/css', :href => '/style.css' }
<script type="text/javascript" src="http://use.typekit.com/wfg6cvc.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
%body
#header
%a.date{ :href => '/' } 6 May 2010
#main
= yield
#footer
%p
%a{ :href => '/' } Home
%p
%a{ :href => '/how-the-council-election-works' } How the council election works
-#


+ 10
- 2
views/wards.haml Ver ficheiro

@@ -1,3 +1,9 @@
-#
- if @postcode
%h2
If you live in
= @postcode

%h1
Candidates for
= @ward.constituency.name
@@ -15,7 +21,8 @@
= candidate.forenames
= candidate.surname
%br
= candidate.party.name
%span.candidate_party
= candidate.party.name
%p.highlight
This list of candidates may be incomplete as people have until
@@ -46,4 +53,5 @@
= candidate.forenames
= candidate.surname
%br
= candidate.party.name
%span.candidate_party
= candidate.party.name

Carregando…
Cancelar
Guardar