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.
 
 
 
 

169 lines
5.1 KiB

  1. - @page_title = "#{@district.name} #{@district.body.district_name} results, #{@body.name} election #{short_date(@election.d)}"
  2. %nav
  3. - if @districts_in_this_election.size > 1
  4. - @district_index = @districts_in_this_election.index(@district)
  5. - unless @district_index == 0 # Don't show the previous link if this is the first district for this election
  6. - @previous_district = @districts_in_this_election[@district_index - 1]
  7. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@previous_district.slug}" }<
  8. &laquo;&nbsp;
  9. = @previous_district.name
  10. &nbsp;&nbsp;&nbsp;
  11. - unless @district_index == @districts_in_this_election.size - 1 # Don't show the next link if this is the last district for this election
  12. - @next_district = @districts_in_this_election[@district_index + 1]
  13. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@next_district.slug}" }<
  14. = @next_district.name
  15. &raquo;
  16. %p
  17. %a{ :href => "/bodies/#{@district.body.slug}/elections/#{@election.d}" }<
  18. = @body.name
  19. = @election.kind
  20. &nbsp;
  21. = long_date(@election.d)
  22. %h1
  23. %a{ :href => "/bodies/#{@district.body.slug}/#{@district.body.district_name.pluralize(2)}/#{@district.slug}" }
  24. = @district.name + " " + @district.body.district_name
  25. - @election_held = Candidacy.sum(:votes, :election => @election, :district => @district)
  26. - unless @election_held
  27. .warning
  28. We don't have the results for this election yet.
  29. %table
  30. %tr.header
  31. %th &nbsp;
  32. %th &nbsp;
  33. %th &nbsp;
  34. %th &nbsp;
  35. %th.right votes
  36. %th.right % votes
  37. %th &nbsp;
  38. - count = 0
  39. - @candidacies.each do |candidacy|
  40. - count += 1
  41. %tr.vcard
  42. %td= count
  43. %td{ :style => "background-color: #{candidacy.party.colour}" } &nbsp;
  44. %td.candidate_name.fn
  45. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  46. = candidacy.candidate.short_name
  47. %td.org
  48. = party_name(candidacy.labcoop, candidacy.party.name)
  49. - if @election_held
  50. %td.right= commify(candidacy.votes)
  51. %td.right= format_percent(candidacy.votes.to_f / @share_denominator * 100)
  52. - if candidacy.seats == 1
  53. %td.elected.elected_text="Elected"
  54. - else
  55. %td &nbsp;
  56. - else
  57. %td.right &mdash;
  58. %td.right &mdash;
  59. %td
  60. %tr.footer
  61. %td &nbsp;
  62. %td &nbsp;
  63. %td &nbsp;
  64. %td &nbsp;
  65. %td.right= commify(@total_votes)
  66. %td &nbsp;
  67. %td &nbsp;
  68. - if @share_message
  69. .warning
  70. = @share_message
  71. - if @total_seats > 1
  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. - if @poll.ballot_papers_issued
  119. %tr
  120. %td Ballot papers issued
  121. %td.right= commify(@poll.ballot_papers_issued)
  122. - if @poll.electorate
  123. %tr
  124. %td Electorate
  125. %td.right= commify(@poll.electorate)
  126. - if @poll.turnout_percent > 0
  127. %tr
  128. %td Turnout
  129. %td.right= sprintf("%.0f%%", @poll.turnout_percent)
  130. -# Show this table conditionally as sometimes we have electorate data but no
  131. -# breakdown of rejected ballot papers
  132. - if @poll.rejected_no_official_mark
  133. %h2 Rejected ballot papers
  134. %table
  135. %tr
  136. %td No official mark on the ballot paper
  137. %td.right= commify(@poll.rejected_no_official_mark)
  138. %tr
  139. %td Voting for too many candidates
  140. %td.right= commify(@poll.rejected_too_many_candidates)
  141. %tr
  142. %td Voter could be identified by writing or a mark on the ballot paper
  143. %td.right= commify(@poll.rejected_identifiable_voter)
  144. %tr
  145. %td Ballot paper unmarked or voter's intention uncertain
  146. %td.right= commify(@poll.rejected_blank_or_uncertain)
  147. %tr.footer
  148. %td &nbsp;
  149. %td.right= commify(@poll.total_rejected_ballots)