Election results in the London Borough of Sutton.
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

electionsummary.haml 4.6 KiB

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