Election results in the London Borough of Sutton.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

131 rader
3.6 KiB

  1. - @page_title = "#{@district.name} #{@district.body.district_name} results, #{@body.name} election #{short_date(@election.d)}"
  2. %p
  3. %a{ :href => "/bodies/#{@district.body.slug}/elections/#{@election.d}" }<
  4. = @body.name
  5. election
  6. &nbsp;
  7. = long_date(@election.d)
  8. .nav
  9. - if @districts_in_this_election.size > 1
  10. - @district_index = @districts_in_this_election.index(@district)
  11. - unless @district_index == 0 # Don't show the previous link if this is the first district for this election
  12. - @previous_district = @districts_in_this_election[@district_index - 1]
  13. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@previous_district.slug}" }<
  14. &laquo;&nbsp;
  15. = @previous_district.name
  16. &nbsp;&nbsp;&nbsp;
  17. - unless @district_index == @districts_in_this_election.size - 1 # Don't show the next link if this is the last district for this election
  18. - @next_district = @districts_in_this_election[@district_index + 1]
  19. %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@next_district.slug}" }<
  20. = @next_district.name
  21. &raquo;
  22. %p
  23. %a{ :href => "/bodies/#{@district.body.slug}/#{@district.body.district_name.pluralize(2)}/#{@district.slug}" }
  24. All elections in
  25. = @district.name
  26. &raquo;
  27. %h1= @district.name + " " + @district.body.district_name
  28. - @election_held = Candidacy.sum(:votes, :election => @election, :district => @district)
  29. - unless @election_held
  30. .warning
  31. We don't have the results for this election yet.
  32. %h2 Votes by party
  33. %table
  34. %tr.header
  35. %th &nbsp;
  36. %th &nbsp;
  37. %th &nbsp;
  38. %th.right.highlight seats won
  39. %th candidates
  40. %th.right votes
  41. %th.right % votes
  42. - count = 0
  43. - @results_by_party.each do |row|
  44. - count += 1
  45. %tr
  46. %td.right= count
  47. %td{ :style => "background-color: #{row['party_colour'] }" } &nbsp;
  48. %td= row['party_name']
  49. - if @election_held
  50. %td.right.highlight= row['num_seats']
  51. - else
  52. %td.right.highlight &mdash;
  53. %td.right= row['num_candidates']
  54. - if @election_held
  55. %td.right= commify(row['total_votes'])
  56. %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
  57. - else
  58. %td.right &mdash;
  59. %td.right &mdash;
  60. %tr.footer
  61. %td &nbsp;
  62. %td &nbsp;
  63. %td &nbsp;
  64. - if @election_held
  65. %td.right.highlight= @total_seats
  66. - else
  67. %td.right.highlight &nbsp;
  68. %td.right= @total_candidates
  69. %td.right= commify(@total_votes)
  70. %td &nbsp;
  71. %h2 Votes by candidate
  72. %table
  73. %tr.header
  74. %th &nbsp;
  75. %th &nbsp;
  76. %th &nbsp;
  77. %th &nbsp;
  78. %th.right votes
  79. %th.right % votes
  80. %th &nbsp;
  81. - count = 0
  82. - @candidacies.each do |candidacy|
  83. - count += 1
  84. %tr.vcard
  85. %td= count
  86. %td{ :style => "background-color: #{candidacy.party.colour}" } &nbsp;
  87. %td.candidate_name.fn
  88. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  89. = candidacy.candidate.short_name
  90. %td.org
  91. = party_name(candidacy.labcoop, candidacy.party.name)
  92. - if @election_held
  93. %td.right= commify(candidacy.votes)
  94. %td.right= format_percent(candidacy.votes.to_f / @total_votes * 100)
  95. - if candidacy.seats == 1
  96. %td.elected="Elected"
  97. - else
  98. %td &nbsp;
  99. - else
  100. %td.right &mdash;
  101. %td.right &mdash;
  102. %td
  103. %tr.footer
  104. %td &nbsp;
  105. %td &nbsp;
  106. %td &nbsp;
  107. %td &nbsp;
  108. %td.right= commify(@total_votes)
  109. %td &nbsp;
  110. %td &nbsp;