Election results in the London Borough of Sutton.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

resultsdistrict.haml 3.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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
  74. %span.candidate_name.fn
  75. %a{ :href => "/candidates/#{candidacy.candidate.id}" }
  76. = candidacy.candidate.short_name
  77. %td
  78. %span.candidate_party.org
  79. = candidacy.party.name
  80. %td.right= commify(candidacy.votes)
  81. %td.right= format_percent(candidacy.votes.to_f / @total_votes * 100)
  82. - if candidacy.seats == 1
  83. %td.elected="Elected"
  84. - else
  85. %td &nbsp;
  86. %tr.footer
  87. %td &nbsp;
  88. %td &nbsp;
  89. %td &nbsp;
  90. %td &nbsp;
  91. %td.right= commify(@total_votes)
  92. %td &nbsp;
  93. %td &nbsp;