Election results in the London Borough of Sutton.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

140 行
4.3 KiB

  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. «
  13. Previous
  14. = @election.body.name
  15. election
  16.    
  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. »
  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  
  55. %th  
  56. %th.highlight seats won
  57. %th votes
  58. %th % votes
  59. - if @total_seats > 1
  60. %th % seats
  61. %th votes per seat
  62. %th candidates
  63. %th votes per candidate
  64. -#
  65. %th relative popularity
  66. - @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
  67. - @results_by_party.each do |row|
  68. %tr
  69. %td{ :style => "background-color: #{row.colour}" }  
  70. %td.data_party= row.name
  71. %td.data_seats.right.highlight= row.seatz
  72. %td.data_votes.right= commify(row.votez)
  73. - if @election_held
  74. %td.right= format_percent(row.votez.to_f / @total_votes * 100)
  75. - if @total_seats > 1
  76. %td.right= format_percent(row.seatz.to_f / @total_seats * 100)
  77. %td.data_votes_per_seat.right
  78. - if row.seatz > 0
  79. = commify(row.votez / row.seatz)
  80. - else
  81. —
  82. %td.data_candidates.right= row.cands
  83. - if @election_held && @total_seats > 1
  84. %td.right= commify(row.votez / row.cands)
  85. -#
  86. %td.right= format_percent( ( row.votez.to_f / row.cands.to_f ) / @max_votes_per_candidate * 100)
  87. %tr.footer
  88. %td  
  89. %td  
  90. %td.right.highlight= @total_seats
  91. %td.right= commify(@total_votes)
  92. %td  
  93. - if @total_seats > 1
  94. %td  
  95. %td  
  96. %td.right= commify(@election.candidacies.count)
  97. %td  
  98. - if @election.ballot_papers_issued
  99. %table
  100. %tr
  101. %td Electorate
  102. %td.right= commify(@election.electorate)
  103. %tr
  104. %td Ballot papers issued
  105. %td.right= commify(@election.ballot_papers_issued)
  106. %tr
  107. %td Turnout
  108. %td.right= sprintf("%.0f%%", @election.ballot_papers_issued / @election.electorate.to_f * 100)
  109. %h2
  110. = "Candidate".pluralize(@total_seats)
  111. elected
  112. %table
  113. - @election.polls.each do |p|
  114. %tr
  115. %td
  116. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{p.district.slug}"}
  117. = p.district.name
  118. - p.successful_candidacies.each do |sc|
  119. %td{ :style => "background-color: #{sc.party.colour};" }
  120. -# %a{ :href => sc.candidate.url }
  121. = sc.candidate.short_name