Election results in the London Borough of Sutton.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

157 wiersze
4.6 KiB

  1. - @page_title = "#{@election.body.name} #{@election.kind} #{long_date(@election.d)}"
  2. .nav
  3. %p
  4. %a{ :href => "/bodies/#{@election.body.slug}" }
  5. «
  6. = @election.body.name
  7. - if @elections_for_this_body.size > 1
  8. %p
  9. - @election_index = @elections_for_this_body.index(@election)
  10. - unless @election_index == 0
  11. - @previous_election = @elections_for_this_body[@election_index - 1]
  12. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@previous_election.d}", :title => "Previous #{@election.body.name} election" }<
  13. &laquo;
  14. = @previous_election.kind
  15. &nbsp;
  16. = short_date(@previous_election.d)
  17. &nbsp;&nbsp;&nbsp;
  18. - unless @election_index == @elections_for_this_body.size - 1
  19. - @next_election = @elections_for_this_body[@election_index + 1]
  20. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@next_election.d}", :title => "Next #{@election.body.name} election" }<
  21. = @next_election.kind
  22. &nbsp;
  23. = short_date(@next_election.d)
  24. &raquo;
  25. %h1
  26. = @election.body.name
  27. = @election.kind
  28. %br
  29. = long_date(@election.d)
  30. -# Does this election have any recorded votes, i.e. has it been held?
  31. - @election_held = Candidacy.sum(:votes, :election => @election)
  32. - unless @election_held
  33. .warning
  34. We don't have the results for this election yet.
  35. %p= @polling_station
  36. %p= @election.reason
  37. %p
  38. = @election.candidacies.count
  39. = "candidate".pluralize(@election.candidacies.count)
  40. - if @election_held
  41. contested
  42. - else
  43. will be contesting
  44. -# We can't calculate the number of seats being contested if the election hasn't been held
  45. - if @election_held
  46. = @total_seats
  47. = "seat".pluralize(@total_seats)
  48. in
  49. = @total_districts
  50. = @election.body.district_name.pluralize(@total_districts)
  51. in Sutton.
  52. - if @election_held
  53. %table
  54. %tr.header
  55. %th &nbsp;
  56. %th &nbsp;
  57. %th.highlight seats won
  58. %th votes
  59. %th % seats
  60. %th % votes
  61. %th votes per seat
  62. %th candidates
  63. %th votes per candidate
  64. -#
  65. %th relative popularity
  66. - @max_votes_per_candidate = @results_by_party.first.votez.to_f / @results_by_party.first.cands.to_f # We really need to scan the array for the max value
  67. - @results_by_party.each do |row|
  68. %tr
  69. %td{ :style => "background-color: #{row.colour}" } &nbsp;
  70. %td.data_party= row.name
  71. %td.data_seats.right.highlight= row.seatz
  72. %td.data_votes.right= commify(row.votez)
  73. - if @election_held
  74. %td.right= format_percent(row.seatz.to_f / @total_seats * 100)
  75. %td.right= format_percent(row.votez.to_f / @total_votes * 100)
  76. %td.data_votes_per_seat.right
  77. - if row.seatz > 0
  78. = commify(row.votez / row.seatz)
  79. - else
  80. &mdash;
  81. %td.data_candidates.right= row.cands
  82. - if @election_held
  83. %td.right= commify(row.votez / row.cands)
  84. -#
  85. %td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
  86. %tr.footer
  87. %td &nbsp;
  88. %td &nbsp;
  89. %td.right.highlight= @total_seats
  90. %td.right= commify(@total_votes)
  91. %td &nbsp;
  92. %td &nbsp;
  93. %td &nbsp;
  94. %td &nbsp;
  95. %td &nbsp;
  96. - if @election.ballot_papers_issued
  97. %table
  98. %tr
  99. %td Electorate
  100. %td.right= commify(@election.electorate)
  101. %tr
  102. %td Ballot papers issued
  103. %td.right= commify(@election.ballot_papers_issued)
  104. %tr
  105. %td Turnout
  106. %td.right= sprintf("%.0f%%", @election.ballot_papers_issued / @election.electorate.to_f * 100)
  107. %h2
  108. = @election.body.district_name.capitalize.pluralize(2)
  109. contested in this election
  110. %table
  111. %tr.header
  112. %th &nbsp;
  113. %th seats
  114. %th candidates
  115. %th votes
  116. - @results_by_district.each do |row|
  117. %tr
  118. %td
  119. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{row.district_slug}"}
  120. = row.name
  121. %td.right= row.seats
  122. %td.right= row.num_candidates
  123. %td.right= commify(row.votez)
  124. %tr.footer
  125. %td &nbsp;
  126. %td.right= @total_seats
  127. %td.right= @election.candidacies.count
  128. %td.right= commify(@total_votes)
  129. - else
  130. %h2
  131. = @election.body.district_name.capitalize.pluralize(2)
  132. being contested at this election
  133. %table
  134. - @districts_in_this_election.each do |d|
  135. %tr
  136. %td
  137. %a{ :href => "/bodies/#{@election.body.slug}/#{@election.body.districts_name}/#{d['slug']}"}
  138. = d['name']