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.
 
 
 
 

168 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. « 
  9. = @previous_district.name
  10.    
  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. »
  16. %p
  17. %a{ :href => "/bodies/#{@district.body.slug}/elections/#{@election.d}" }
  18. = @body.name
  19. = @election.kind
  20. = long_date(@election.d)
  21. %h1
  22. %a{ :href => "/bodies/#{@district.body.slug}/#{@district.body.district_name.pluralize(2)}/#{@district.slug}" }
  23. = @district.name + " " + @district.body.district_name
  24. - @election_held = Candidacy.sum(:votes, :election => @election, :district => @district)
  25. - unless @election_held
  26. .warning
  27. We don't have the results for this election yet.
  28. %table
  29. %tr.header
  30. %th  
  31. %th  
  32. %th  
  33. %th  
  34. %th.right votes
  35. %th.right % voters
  36. %th  
  37. - count = 0
  38. - @candidacies.each do |candidacy|
  39. - count += 1
  40. %tr.vcard
  41. %td= count
  42. %td{ :style => "background-color: #{candidacy.party.colour}" }  
  43. %td.candidate_name.fn
  44. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  45. = candidacy.candidate.short_name
  46. %td.org
  47. = party_name(candidacy.labcoop, candidacy.party.name)
  48. - if @election_held
  49. %td.right= commify(candidacy.votes)
  50. %td.right= format_percent(candidacy.votes.to_f / @share_denominator * 100)
  51. - if candidacy.seats == 1
  52. %td.elected.elected_text="Elected"
  53. - else
  54. %td  
  55. - else
  56. %td.right —
  57. %td.right —
  58. %td
  59. %tr.footer
  60. %td  
  61. %td  
  62. %td  
  63. %td  
  64. %td.right= commify(@total_votes)
  65. %td  
  66. %td  
  67. - if @share_message
  68. .warning
  69. = @share_message
  70. - if @total_seats > 1
  71. %h2 Votes by party
  72. %table
  73. %tr.header
  74. %th  
  75. %th  
  76. %th  
  77. %th.right.highlight seats won
  78. %th candidates
  79. %th.right votes
  80. %th.right % votes
  81. %th.right votes per candidate
  82. - count = 0
  83. - @results_by_party.each do |row|
  84. - count += 1
  85. %tr
  86. %td.right= count
  87. %td{ :style => "background-color: #{row['party_colour'] }" }  
  88. %td= row['party_name']
  89. - if @election_held
  90. %td.right.highlight= row['num_seats']
  91. - else
  92. %td.right.highlight —
  93. %td.right= row['num_candidates']
  94. - if @election_held
  95. %td.right= commify(row['total_votes'])
  96. %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
  97. %td.right= commify(row['total_votes'] / row['num_candidates'])
  98. - else
  99. %td.right —
  100. %td.right —
  101. %td.right —
  102. %tr.footer
  103. %td  
  104. %td  
  105. %td  
  106. - if @election_held
  107. %td.right.highlight= @total_seats
  108. - else
  109. %td.right.highlight  
  110. %td.right= @total_candidates
  111. %td.right= commify(@total_votes)
  112. %td  
  113. %td  
  114. - if @poll
  115. %p
  116. %table
  117. - if @poll.ballot_papers_issued
  118. %tr
  119. %td Ballot papers issued
  120. %td.right= commify(@poll.ballot_papers_issued)
  121. - if @poll.electorate
  122. %tr
  123. %td Electorate
  124. %td.right= commify(@poll.electorate)
  125. - if @poll.turnout_percent > 0
  126. %tr
  127. %td Turnout
  128. %td.right= sprintf("%.0f%%", @poll.turnout_percent)
  129. -# Show this table conditionally as sometimes we have electorate data but no
  130. -# breakdown of rejected ballot papers
  131. - if @poll.rejected_no_official_mark
  132. %h2 Rejected ballot papers
  133. %table
  134. %tr
  135. %td No official mark on the ballot paper
  136. %td.right= commify(@poll.rejected_no_official_mark)
  137. %tr
  138. %td Voting for too many candidates
  139. %td.right= commify(@poll.rejected_too_many_candidates)
  140. %tr
  141. %td Voter could be identified by writing or a mark on the ballot paper
  142. %td.right= commify(@poll.rejected_identifiable_voter)
  143. %tr
  144. %td Ballot paper unmarked or voter's intention uncertain
  145. %td.right= commify(@poll.rejected_blank_or_uncertain)
  146. %tr.footer
  147. %td  
  148. %td.right= commify(@poll.total_rejected_ballots)