Browse Source

Added parliament results view file

tags/last-sinatra-version
Adrian Short 14 years ago
parent
commit
ba8e2d6d77
1 changed files with 48 additions and 0 deletions
  1. +48
    -0
      views/resultsukparliament.haml

+ 48
- 0
views/resultsukparliament.haml View File

@@ -0,0 +1,48 @@
.grid_12

%p UK Parliament Election 6 May 2010 Results
%h1= @constituency.name + " Constituency"
- @page_title = @constituency.name + " Constituency Results, UK Parliament Election 6 May 2010"
- count = 0
%table
%tr
%th
%th
%th Votes
%th %
%th Change
- for candidate in @candidates
- count += 1
%tr.vcard
%td= count
%td
%span.candidate_name.fn
= candidate.forenames.split(' ')[0]
= candidate.surname
%br
%span.candidate_party.org
= candidate.party.name
%td.right= candidate.votes_2010
%td.right
- pc_2010 = candidate.votes_2010.to_f / @total_2010 * 100
= sprintf("%0.1f%%", pc_2010)
%td.right
- unless candidate.percent_2005.nil?
- change_2010 = pc_2010 - candidate.percent_2005
= sprintf("%+0.1f%%", change_2010)
%td
- if count == 1
%strong ELECTED
%p
Total votes:
= @total_2010

Loading…
Cancel
Save