Election results in the London Borough of Sutton.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

electionsummary.haml 3.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. %p= @election.reason
  31. - if @election.candidacies.count > 0
  32. %p
  33. = @election.candidacies.count
  34. = "candidate".pluralize(@election.candidacies.count)
  35. contested
  36. = @total_seats
  37. = "seat".pluralize(@total_seats)
  38. in
  39. = @total_districts
  40. = @election.body.district_name.pluralize(@total_districts)
  41. in Sutton.
  42. %h2 Seats, votes and candidates by party
  43. %table
  44. %tr.header
  45. %th &nbsp;
  46. %th &nbsp;
  47. %th.highlight seats won
  48. %th votes
  49. %th % seats
  50. %th % votes
  51. %th votes per seat
  52. %th candidates
  53. %th votes per candidate
  54. -#
  55. %th relative popularity
  56. - @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
  57. - @results_by_party.each do |row|
  58. %tr
  59. %td{ :style => "background-color: #{row.colour}" } &nbsp;
  60. %td.data_party= row.name
  61. %td.data_seats.right.highlight= row.seatz
  62. %td.data_votes.right= commify(row.votez)
  63. %td.right= format_percent(row.seatz.to_f / @total_seats * 100)
  64. %td.right= format_percent(row.votez.to_f / @total_votes * 100)
  65. %td.data_votes_per_seat.right
  66. - if row.seatz > 0
  67. = commify(row.votez / row.seatz)
  68. - else
  69. &mdash;
  70. %td.data_candidates.right= row.cands
  71. %td.right= commify(row.votez / row.cands)
  72. -#
  73. %td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
  74. %tr.footer
  75. %td &nbsp;
  76. %td &nbsp;
  77. %td.right.highlight= @total_seats
  78. %td.right= commify(@total_votes)
  79. %td &nbsp;
  80. %td &nbsp;
  81. %td &nbsp;
  82. %td &nbsp;
  83. %td &nbsp;
  84. %h2
  85. = @election.body.district_name.capitalize.pluralize(2)
  86. contested in this election
  87. %table
  88. %tr.header
  89. %th &nbsp;
  90. %th seats
  91. %th candidates
  92. %th votes
  93. - @results_by_district.each do |row|
  94. %tr
  95. %td
  96. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{row.district_slug}"}
  97. = row.name
  98. %td.right= row.seats
  99. %td.right= row.num_candidates
  100. %td.right= commify(row.votez)
  101. %tr.footer
  102. %td &nbsp;
  103. %td.right= @total_seats
  104. %td.right= @election.candidacies.count
  105. %td.right= commify(@total_votes)
  106. - else
  107. %p Full details and results will be available on this page.