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.

resultsdistrict.haml 5.1 KiB

13 years ago
12 years ago
13 years ago
12 years ago
13 years ago
12 years ago
13 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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 / @share_denominator * 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. - if @share_message
  73. .warning
  74. = @share_message
  75. %p.noprint
  76. %a{ :href => "?wiki=dokuwiki" }
  77. DokuWiki
  78. - if @total_seats > 1
  79. %h2 Votes by party
  80. %table
  81. %tr.header
  82. %th &nbsp;
  83. %th &nbsp;
  84. %th &nbsp;
  85. %th.right.highlight seats won
  86. %th candidates
  87. %th.right votes
  88. %th.right % votes
  89. %th.right votes per candidate
  90. - count = 0
  91. - @results_by_party.each do |row|
  92. - count += 1
  93. %tr
  94. %td.right= count
  95. %td{ :style => "background-color: #{row['party_colour'] }" } &nbsp;
  96. %td= row['party_name']
  97. - if @election_held
  98. %td.right.highlight= row['num_seats']
  99. - else
  100. %td.right.highlight &mdash;
  101. %td.right= row['num_candidates']
  102. - if @election_held
  103. %td.right= commify(row['total_votes'])
  104. %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
  105. %td.right= commify(row['total_votes'] / row['num_candidates'])
  106. - else
  107. %td.right &mdash;
  108. %td.right &mdash;
  109. %td.right &mdash;
  110. %tr.footer
  111. %td &nbsp;
  112. %td &nbsp;
  113. %td &nbsp;
  114. - if @election_held
  115. %td.right.highlight= @total_seats
  116. - else
  117. %td.right.highlight &nbsp;
  118. %td.right= @total_candidates
  119. %td.right= commify(@total_votes)
  120. %td &nbsp;
  121. %td &nbsp;
  122. - if @poll
  123. %p
  124. %table
  125. - if @poll.ballot_papers_issued
  126. %tr
  127. %td Ballot papers issued
  128. %td.right= commify(@poll.ballot_papers_issued)
  129. - if @poll.electorate
  130. %tr
  131. %td Electorate
  132. %td.right= commify(@poll.electorate)
  133. - if @poll.turnout_percent > 0
  134. %tr
  135. %td Turnout
  136. %td.right= sprintf("%.0f%%", @poll.turnout_percent)
  137. -# Show this table conditionally as sometimes we have electorate data but no
  138. -# breakdown of rejected ballot papers
  139. - if @poll.rejected_no_official_mark
  140. %h2 Rejected ballot papers
  141. %table
  142. %tr
  143. %td Want of official mark
  144. %td.right= commify(@poll.rejected_no_official_mark)
  145. %tr
  146. %td Voting for too many candidates
  147. %td.right= commify(@poll.rejected_too_many_candidates)
  148. %tr
  149. %td Writing or mark by which the voter could be identified
  150. %td.right= commify(@poll.rejected_identifiable_voter)
  151. %tr
  152. %td Unmarked or void for uncertainty
  153. %td.right= commify(@poll.rejected_blank_or_uncertain)
  154. %tr.footer
  155. %td &nbsp;
  156. %td.right= commify(@poll.total_rejected_ballots)