Election results in the London Borough of Sutton.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

electionsummary.haml 4.2 KiB

13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
13 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. %nav
  2. %a{ :href => "/bodies/#{election.body.slug}" }
  3. «
  4. = election.body.name
  5. - if elections_for_this_body.size > 1
  6. %p
  7. - election_index = elections_for_this_body.index(election)
  8. - unless election_index == 0
  9. - previous_election = elections_for_this_body[election_index - 1]
  10. %a{ :href => "/bodies/#{election.body.slug}/elections/#{previous_election.d.to_s}", :title => "#{previous_election.kind} #{short_date(previous_election.d.to_s)}" }
  11. «
  12. Previous
  13. = election.body.name
  14. election
  15.    
  16. - unless election_index == elections_for_this_body.size - 1
  17. - next_election = elections_for_this_body[election_index + 1]
  18. %a{ :href => "/bodies/#{election.body.slug}/elections/#{next_election.d.to_s}", :title => "#{next_election.kind} #{short_date(next_election.d)}" }
  19. Next
  20. = election.body.name
  21. election
  22. »
  23. %h1
  24. = election.body.name
  25. = election.kind
  26. %br
  27. = long_date(election.d)
  28. -# Does this election have any recorded votes, i.e. has it been held?
  29. - election_held = Candidacy.sum(:votes, :election => election)
  30. - unless election_held
  31. .warning
  32. We don't have the results for this election yet.
  33. -# %p= polling_station
  34. %p= election.reason
  35. %p
  36. = election.candidacies.count
  37. = "candidate".pluralize(election.candidacies.count)
  38. - if election_held
  39. contested
  40. - else
  41. will be contesting
  42. -# We can't calculate the number of seats being contested if the election hasn't been held
  43. - if election_held
  44. = total_seats
  45. = "seat".pluralize(total_seats)
  46. in
  47. = total_districts
  48. = election.body.district_name.pluralize(total_districts)
  49. in Sutton.
  50. - if election_held
  51. %table
  52. %tr.header
  53. %th  
  54. %th  
  55. %th.highlight seats won
  56. %th votes
  57. %th % votes
  58. - if total_seats > 1
  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}" }  
  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. - if total_seats > 1
  75. %td.right= format_percent(row.seatz.to_f / total_seats * 100)
  76. %td.data_votes_per_seat.right
  77. - if row.seatz > 0
  78. = commify(row.votez / row.seatz)
  79. - else
  80. —
  81. %td.data_candidates.right= row.cands
  82. - if election_held && total_seats > 1
  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  
  88. %td  
  89. %td.right.highlight= total_seats
  90. %td.right= commify(total_votes)
  91. %td  
  92. - if total_seats > 1
  93. %td  
  94. %td  
  95. %td.right= commify(election.candidacies.count)
  96. %td  
  97. - if election.ballot_papers_issued
  98. %table
  99. %tr
  100. %td Electorate
  101. %td.right= commify(election.electorate)
  102. %tr
  103. %td Ballot papers issued
  104. %td.right= commify(election.ballot_papers_issued)
  105. %tr
  106. %td Turnout
  107. %td.right= sprintf("%.0f%%", election.ballot_papers_issued / election.electorate.to_f * 100)
  108. %h2
  109. = "Candidate".pluralize(total_seats)
  110. elected
  111. %table
  112. - election.polls.each do |p|
  113. %tr
  114. %td
  115. %a{ :href => "/bodies/#{election.body.slug}/elections/#{election.d.to_s}/#{election.body.districts_name}/#{p.district.slug}"}
  116. = p.district.name
  117. - p.successful_candidacies.each do |sc|
  118. %td{ :style => "background-color: #{sc.party.colour};" }
  119. -# %a{ :href => sc.candidate.url }
  120. = sc.candidate.short_name