Browse Source

Added ward map to home page

tags/last-sinatra-version
Adrian Short 14 years ago
parent
commit
7a48f8a3eb
6 changed files with 134 additions and 3 deletions
  1. +12
    -2
      app.rb
  2. BIN
      public/3ld.png
  3. BIN
      public/ld1.png
  4. BIN
      public/ld2.png
  5. +63
    -0
      public/style.css
  6. +59
    -1
      views/home.haml

+ 12
- 2
app.rb View File

@@ -23,8 +23,6 @@ get '/' do
redirect "/wards/#{@ward.slug}/postcode/#{@postcode}"
end
@wards = Ward.all
@results = repository(:default).adapter.query("
SELECT p.name,
sum(c.votes_2010) AS votes,
@@ -85,6 +83,14 @@ get '/results/sutton-council/2010-05-06/:slug' do
haml :resultssuttoncouncil
end

get '/results/sutton-council/2010-05-06.csv' do
@ward = Ward.first(:slug => params[:slug])
@candidates = Councilcandidate.all(:ward_id => @ward.id, :order => [ :votes_2010.desc ])
@total_2010 = Councilcandidate.sum(:votes_2010, :ward_id => @ward.id)
haml :resultssuttoncouncil
end


get '/how-the-council-election-works' do
haml :election
end
@@ -109,6 +115,10 @@ get '/aliens' do
haml :aliens
end

get '/wardmap' do
haml :wardmap
end

not_found do
haml :not_found
end

BIN
public/3ld.png View File

Before After
Width: 100  |  Height: 100  |  Size: 444 B

BIN
public/ld1.png View File

Before After
Width: 200  |  Height: 100  |  Size: 646 B

BIN
public/ld2.png View File

Before After
Width: 200  |  Height: 100  |  Size: 730 B

+ 63
- 0
public/style.css View File

@@ -134,4 +134,67 @@ tr
.noborder
{
border: 0;
}

/* Wardmap */

.wardmap tr, .wardmap td.blank
{
border: 0;
}

.wardmap td
{
border: 3px solid #fff;
width: 10%;
height: 80px;
padding: 10px;
text-align: center;
font-size: 90%;
}

.wardmap a, .wardmap a:visited
{
background-color: white;
color: black;
padding: 3px;
line-height: 1.5em;
width: 70%;
}

.wardmap a:hover
{
background-color: black;
color: white;
padding: 3px;
line-height: 1.5em;
width: 70%;
}



.ld3
{
background-color: orange;
color: white;
}

.ld2
{
background-color: orange;
background-image: url('ld2.png');
color: white;
}

.ld1
{
background-color: blue;
background-image: url('ld1.png');
color: white;
}

.con3
{
background-color: blue;
color: white;
}

+ 59
- 1
views/home.haml View File

@@ -50,7 +50,65 @@
%td
%h2 Sutton Council Results by Ward

%table.wardmap
%tr
%td.blank
%td.blank
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/st-helier' } St Helier
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/wandle-valley' } Wandle Valley
%td.blank
%td.blank
%tr
%td.ld2
%a{ :href => 'results/sutton-council/2010-05-06/worcester-park' } Worcester Park
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/stonecot' } Stonecot
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/sutton-north' } Sutton North
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/the-wrythe' } The Wrythe
%td.blank
%td.blank
%tr
%td.ld2
%a{ :href => 'results/sutton-council/2010-05-06/nonsuch' } Nonsuch
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/sutton-west' } Sutton West
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/sutton-central' } Sutton Central
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/carshalton-central' } Carshalton Central
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/wallington-north' } Wallington North
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/beddington-north' } Beddington North
%tr
%td.blank
%td.ld1
%a{ :href => 'results/sutton-council/2010-05-06/cheam' } Cheam
%td.ld2
%a{ :href => 'results/sutton-council/2010-05-06/sutton-south' } Sutton South
%td.ld1
%a{ :href => 'results/sutton-council/2010-05-06/carshalton-south-and-clockhouse' } Carshalton South & Clockhouse
%td.ld3
%a{ :href => 'results/sutton-council/2010-05-06/wallington-south' } Wallington South
%td.ld2
%a{ :href => 'results/sutton-council/2010-05-06/beddington-south' } Beddington South
%tr
%td.blank
%td.blank
%td.con3
%a{ :href => 'results/sutton-council/2010-05-06/belmont' } Belmont
%td.blank
%td.blank
%td.blank

-#
- for ward in @wards
%p
%a{ :href=> "/results/sutton-council/2010-05-06/#{ward.slug}" }


Loading…
Cancel
Save