Election results in the London Borough of Sutton.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

148 regels
4.1 KiB

  1. - @page_title = "#{@district.name} #{@district.body.district_name} results, #{@body.name} election #{short_date(@election.d)}"
  2. %p
  3. %a{ :href => "/bodies/#{@district.body.slug}/elections/#{@election.d}" }<
  4. = @body.name
  5. election
  6. &nbsp;
  7. = long_date(@election.d)
  8. .nav
  9. - if @districts_in_this_election.size > 1
  10. - @district_index = @districts_in_this_election.index(@district)
  11. - unless @district_index == 0 # Don't show the previous link if this is the first district for this election
  12. - @previous_district = @districts_in_this_election[@district_index - 1]
  13. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@previous_district.slug}" }<
  14. &laquo;&nbsp;
  15. = @previous_district.name
  16. &nbsp;&nbsp;&nbsp;
  17. - unless @district_index == @districts_in_this_election.size - 1 # Don't show the next link if this is the last district for this election
  18. - @next_district = @districts_in_this_election[@district_index + 1]
  19. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@next_district.slug}" }<
  20. = @next_district.name
  21. &raquo;
  22. %p
  23. %a{ :href => "/bodies/#{@district.body.slug}/#{@district.body.district_name.pluralize(2)}/#{@district.slug}" }
  24. All elections in
  25. = @district.name
  26. &raquo;
  27. %h1= @district.name + " " + @district.body.district_name
  28. - @election_held = Candidacy.sum(:votes, :election => @election, :district => @district)
  29. - unless @election_held
  30. .warning
  31. We don't have the results for this election yet.
  32. %h2 Votes by candidate
  33. %table
  34. %tr.header
  35. %th &nbsp;
  36. %th &nbsp;
  37. %th &nbsp;
  38. %th &nbsp;
  39. %th.right votes
  40. %th.right % votes
  41. %th &nbsp;
  42. - count = 0
  43. - @candidacies.each do |candidacy|
  44. - count += 1
  45. %tr.vcard
  46. %td= count
  47. %td{ :style => "background-color: #{candidacy.party.colour}" } &nbsp;
  48. %td.candidate_name.fn
  49. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  50. = candidacy.candidate.short_name
  51. %td.org
  52. = party_name(candidacy.labcoop, candidacy.party.name)
  53. - if @election_held
  54. %td.right= commify(candidacy.votes)
  55. %td.right= format_percent(candidacy.votes.to_f / @total_votes * 100)
  56. - if candidacy.seats == 1
  57. %td.elected="Elected"
  58. - else
  59. %td &nbsp;
  60. - else
  61. %td.right &mdash;
  62. %td.right &mdash;
  63. %td
  64. %tr.footer
  65. %td &nbsp;
  66. %td &nbsp;
  67. %td &nbsp;
  68. %td &nbsp;
  69. %td.right= commify(@total_votes)
  70. %td &nbsp;
  71. %td &nbsp;
  72. %h2 Votes by party
  73. %table
  74. %tr.header
  75. %th &nbsp;
  76. %th &nbsp;
  77. %th &nbsp;
  78. %th.right.highlight seats won
  79. %th candidates
  80. %th.right votes
  81. %th.right % votes
  82. %th.right votes per candidate
  83. - count = 0
  84. - @results_by_party.each do |row|
  85. - count += 1
  86. %tr
  87. %td.right= count
  88. %td{ :style => "background-color: #{row['party_colour'] }" } &nbsp;
  89. %td= row['party_name']
  90. - if @election_held
  91. %td.right.highlight= row['num_seats']
  92. - else
  93. %td.right.highlight &mdash;
  94. %td.right= row['num_candidates']
  95. - if @election_held
  96. %td.right= commify(row['total_votes'])
  97. %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
  98. %td.right= commify(row['total_votes'] / row['num_candidates'])
  99. - else
  100. %td.right &mdash;
  101. %td.right &mdash;
  102. %td.right &mdash;
  103. %tr.footer
  104. %td &nbsp;
  105. %td &nbsp;
  106. %td &nbsp;
  107. - if @election_held
  108. %td.right.highlight= @total_seats
  109. - else
  110. %td.right.highlight &nbsp;
  111. %td.right= @total_candidates
  112. %td.right= commify(@total_votes)
  113. %td &nbsp;
  114. %td &nbsp;
  115. - if @poll
  116. %p
  117. %table
  118. %tr
  119. %td Ballot papers issued
  120. %td.right= commify(@poll.ballot_papers_issued)
  121. %tr
  122. %td Electorate
  123. %td.right= commify(@poll.electorate)
  124. %tr
  125. %td Turnout
  126. %td.right= sprintf("%.0f%%", @poll.turnout_percent)