Election results in the London Borough of Sutton.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

144 lignes
4.3 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= @election.reason
  36. %p
  37. = @election.candidacies.count
  38. = "candidate".pluralize(@election.candidacies.count)
  39. - if @election_held
  40. contested
  41. - else
  42. will be contesting
  43. -# We can't calculate the number of seats being contested if the election hasn't been held
  44. - if @election_held
  45. = @total_seats
  46. = "seat".pluralize(@total_seats)
  47. in
  48. = @total_districts
  49. = @election.body.district_name.pluralize(@total_districts)
  50. in Sutton.
  51. - if @election_held
  52. %h2 Seats, votes and candidates by party
  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. %h2
  97. = @election.body.district_name.capitalize.pluralize(2)
  98. contested in this election
  99. %table
  100. %tr.header
  101. %th &nbsp;
  102. %th seats
  103. %th candidates
  104. %th votes
  105. - @results_by_district.each do |row|
  106. %tr
  107. %td
  108. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{row.district_slug}"}
  109. = row.name
  110. %td.right= row.seats
  111. %td.right= row.num_candidates
  112. %td.right= commify(row.votez)
  113. %tr.footer
  114. %td &nbsp;
  115. %td.right= @total_seats
  116. %td.right= @election.candidacies.count
  117. %td.right= commify(@total_votes)
  118. - else
  119. %h2
  120. = @election.body.district_name.capitalize.pluralize(2)
  121. being contested at this election
  122. %table
  123. - @districts_in_this_election.each do |d|
  124. %tr
  125. %td
  126. %a{ :href => "/bodies/#{@election.body.slug}/#{@election.body.districts_name}/#{d['slug']}"}
  127. = d['name']