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.

electionsummary.haml 2.4 KiB

13 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. - @page_title = "#{@election.body.name} #{@election.kind} #{long_date(@election.d)}"
  2. %h1
  3. = @election.body.name
  4. = @election.kind
  5. %br
  6. = long_date(@election.d)
  7. %p= @election.reason
  8. - if @election.candidacies.count > 0
  9. %p
  10. = @election.candidacies.count
  11. = "candidate".pluralize(@election.candidacies.count)
  12. contested
  13. = @total_seats
  14. = "seat".pluralize(@total_seats)
  15. in
  16. = @total_districts
  17. = @election.body.district_name.pluralize(@total_districts)
  18. in Sutton.
  19. %h2 Seats, votes and candidates by party
  20. %table
  21. %tr.header
  22. %th
  23. %th
  24. %th.highlight seats won
  25. %th votes
  26. %th % seats
  27. %th % votes
  28. %th votes per seat
  29. %th candidates
  30. %th votes per candidate
  31. -#
  32. %th relative popularity
  33. - @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
  34. - @results_by_party.each do |row|
  35. %tr
  36. %td{ :style => "background-color: #{row.colour}" }  
  37. %td.data_party= row.name
  38. %td.data_seats.right.highlight= row.seatz
  39. %td.data_votes.right= commify(row.votez)
  40. %td.right= format_percent(row.seatz.to_f / @total_seats * 100)
  41. %td.right= format_percent(row.votez.to_f / @total_votes * 100)
  42. %td.data_votes_per_seat.right
  43. - if row.seatz > 0
  44. = commify(row.votez / row.seatz)
  45. - else
  46. —
  47. %td.data_candidates.right= row.cands
  48. %td.right= commify(row.votez / row.cands)
  49. -#
  50. %td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
  51. %tr.footer
  52. %td
  53. %td
  54. %td.right.highlight= @total_seats
  55. %td.right= commify(@total_votes)
  56. %td
  57. %td
  58. %td
  59. %td
  60. %td
  61. -#
  62. %td
  63. %h2
  64. Results by
  65. = @election.body.district_name
  66. %table
  67. %tr.header
  68. %th
  69. %th seats
  70. %th votes
  71. - @results_by_district.each do |row|
  72. %tr
  73. %td
  74. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{row.district_slug}"}
  75. = row.name
  76. %td.right= row.seats
  77. %td.right= commify(row.votez)
  78. %tr.footer
  79. %td
  80. %td.right= @total_seats
  81. %td.right= commify(@total_votes)
  82. - else
  83. %p Full details and results will be available on this page.