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.

resultsdistrict.haml 3.1 KiB

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