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.
 
 
 
 

173 lines
5.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. %table
  33. %tr.header
  34. %th &nbsp;
  35. %th &nbsp;
  36. %th &nbsp;
  37. %th &nbsp;
  38. %th.right votes
  39. %th.right % votes
  40. %th &nbsp;
  41. - count = 0
  42. - @candidacies.each do |candidacy|
  43. - count += 1
  44. %tr.vcard
  45. %td= count
  46. %td{ :style => "background-color: #{candidacy.party.colour}" } &nbsp;
  47. %td.candidate_name.fn
  48. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  49. = candidacy.candidate.short_name
  50. %td.org
  51. = party_name(candidacy.labcoop, candidacy.party.name)
  52. - if @election_held
  53. %td.right= commify(candidacy.votes)
  54. %td.right= format_percent(candidacy.votes.to_f / @share_denominator * 100)
  55. - if candidacy.seats == 1
  56. %td.elected.elected_text="Elected"
  57. - else
  58. %td &nbsp;
  59. - else
  60. %td.right &mdash;
  61. %td.right &mdash;
  62. %td
  63. %tr.footer
  64. %td &nbsp;
  65. %td &nbsp;
  66. %td &nbsp;
  67. %td &nbsp;
  68. %td.right= commify(@total_votes)
  69. %td &nbsp;
  70. %td &nbsp;
  71. - if @share_message
  72. .warning
  73. = @share_message
  74. - if @total_seats > 1
  75. %h2 Votes by party
  76. %table
  77. %tr.header
  78. %th &nbsp;
  79. %th &nbsp;
  80. %th &nbsp;
  81. %th.right.highlight seats won
  82. %th candidates
  83. %th.right votes
  84. %th.right % votes
  85. %th.right votes per candidate
  86. - count = 0
  87. - @results_by_party.each do |row|
  88. - count += 1
  89. %tr
  90. %td.right= count
  91. %td{ :style => "background-color: #{row['party_colour'] }" } &nbsp;
  92. %td= row['party_name']
  93. - if @election_held
  94. %td.right.highlight= row['num_seats']
  95. - else
  96. %td.right.highlight &mdash;
  97. %td.right= row['num_candidates']
  98. - if @election_held
  99. %td.right= commify(row['total_votes'])
  100. %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
  101. %td.right= commify(row['total_votes'] / row['num_candidates'])
  102. - else
  103. %td.right &mdash;
  104. %td.right &mdash;
  105. %td.right &mdash;
  106. %tr.footer
  107. %td &nbsp;
  108. %td &nbsp;
  109. %td &nbsp;
  110. - if @election_held
  111. %td.right.highlight= @total_seats
  112. - else
  113. %td.right.highlight &nbsp;
  114. %td.right= @total_candidates
  115. %td.right= commify(@total_votes)
  116. %td &nbsp;
  117. %td &nbsp;
  118. - if @poll
  119. %p
  120. %table
  121. - if @poll.ballot_papers_issued
  122. %tr
  123. %td Ballot papers issued
  124. %td.right= commify(@poll.ballot_papers_issued)
  125. - if @poll.electorate
  126. %tr
  127. %td Electorate
  128. %td.right= commify(@poll.electorate)
  129. - if @poll.turnout_percent > 0
  130. %tr
  131. %td Turnout
  132. %td.right= sprintf("%.0f%%", @poll.turnout_percent)
  133. -# Show this table conditionally as sometimes we have electorate data but no
  134. -# breakdown of rejected ballot papers
  135. - if @poll.rejected_no_official_mark
  136. %h2 Rejected ballot papers
  137. %table
  138. %tr
  139. %td Want of official mark
  140. %td.right= commify(@poll.rejected_no_official_mark)
  141. %tr
  142. %td Voting for too many candidates
  143. %td.right= commify(@poll.rejected_too_many_candidates)
  144. %tr
  145. %td Writing or mark by which the voter could be identified
  146. %td.right= commify(@poll.rejected_identifiable_voter)
  147. %tr
  148. %td Unmarked or void for uncertainty
  149. %td.right= commify(@poll.rejected_blank_or_uncertain)
  150. %tr.footer
  151. %td &nbsp;
  152. %td.right= commify(@poll.total_rejected_ballots)