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 4.9 KiB

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