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.
 
 
 
 

119 lines
3.4 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;&nbsp;
  14. = @previous_election.kind
  15. = short_date(@previous_election.d)
  16. &nbsp;&nbsp;&nbsp;
  17. - unless @election_index == @elections_for_this_body.size - 1
  18. - @next_election = @elections_for_this_body[@election_index + 1]
  19. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@next_election.d}", :title => "Next #{@election.body.name} election" }<
  20. = @next_election.kind
  21. = short_date(@next_election.d)
  22. &raquo;
  23. %h1
  24. = @election.body.name
  25. = @election.kind
  26. %br
  27. = long_date(@election.d)
  28. %p= @election.reason
  29. - if @election.candidacies.count > 0
  30. %p
  31. = @election.candidacies.count
  32. = "candidate".pluralize(@election.candidacies.count)
  33. contested
  34. = @total_seats
  35. = "seat".pluralize(@total_seats)
  36. in
  37. = @total_districts
  38. = @election.body.district_name.pluralize(@total_districts)
  39. in Sutton.
  40. %h2 Seats, votes and candidates by party
  41. %table
  42. %tr.header
  43. %th
  44. %th
  45. %th.highlight seats won
  46. %th votes
  47. %th % seats
  48. %th % votes
  49. %th votes per seat
  50. %th candidates
  51. %th votes per candidate
  52. -#
  53. %th relative popularity
  54. - @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
  55. - @results_by_party.each do |row|
  56. %tr
  57. %td{ :style => "background-color: #{row.colour}" } &nbsp;
  58. %td.data_party= row.name
  59. %td.data_seats.right.highlight= row.seatz
  60. %td.data_votes.right= commify(row.votez)
  61. %td.right= format_percent(row.seatz.to_f / @total_seats * 100)
  62. %td.right= format_percent(row.votez.to_f / @total_votes * 100)
  63. %td.data_votes_per_seat.right
  64. - if row.seatz > 0
  65. = commify(row.votez / row.seatz)
  66. - else
  67. &mdash;
  68. %td.data_candidates.right= row.cands
  69. %td.right= commify(row.votez / row.cands)
  70. -#
  71. %td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
  72. %tr.footer
  73. %td
  74. %td
  75. %td.right.highlight= @total_seats
  76. %td.right= commify(@total_votes)
  77. %td
  78. %td
  79. %td
  80. %td
  81. %td
  82. -#
  83. %td
  84. %h2
  85. Results by
  86. = @election.body.district_name
  87. %table
  88. %tr.header
  89. %th
  90. %th seats
  91. %th votes
  92. - @results_by_district.each do |row|
  93. %tr
  94. %td
  95. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{row.district_slug}"}
  96. = row.name
  97. %td.right= row.seats
  98. %td.right= commify(row.votez)
  99. %tr.footer
  100. %td
  101. %td.right= @total_seats
  102. %td.right= commify(@total_votes)
  103. - else
  104. %p Full details and results will be available on this page.