Election results in the London Borough of Sutton.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

109 lines
2.8 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. %h2 Votes by party
  29. %table
  30. %tr.header
  31. %th
  32. %th
  33. %th
  34. %th candidates
  35. %th.right votes
  36. %th.right % votes
  37. - count = 0
  38. - @results_by_party.each do |row|
  39. - count += 1
  40. %tr
  41. %td.right= count
  42. %td{ :style => "background-color: #{row['party_colour'] }" } &nbsp;
  43. %td= row['party_name']
  44. %td.right= row['num_candidates']
  45. %td.right= commify(row['total_votes'])
  46. %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100)
  47. %tr.footer
  48. %td
  49. %td
  50. %td
  51. %td
  52. %td.right= commify(@total_votes)
  53. %td
  54. %h2 Votes by candidate
  55. %table
  56. %tr.header
  57. %th
  58. %th
  59. %th
  60. %th.right votes
  61. %th.right % votes
  62. %th
  63. - count = 0
  64. - for candidacy in @candidacies
  65. - count += 1
  66. %tr.vcard
  67. %td= count
  68. %td{ :style => "background-color: #{candidacy.party.colour}" } &nbsp;
  69. %td
  70. %span.candidate_name.fn
  71. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  72. = candidacy.candidate.short_name
  73. %br
  74. %span.candidate_party.org
  75. = candidacy.party.name
  76. %td.right= commify(candidacy.votes)
  77. %td.right= format_percent(candidacy.votes.to_f / @total_votes * 100)
  78. %td
  79. - if candidacy.seats == 1
  80. .elected ELECTED
  81. %tr.footer
  82. %td
  83. %td
  84. %td
  85. %td.right= commify(@total_votes)
  86. %td
  87. %td
  88. %td