- @page_title = "#{@district.name} #{@district.body.district_name} results, #{@body.name} election #{short_date(@election.d)}" %p %a{ :href => "/bodies/#{@district.body.slug}/elections/#{@election.d}" }< = @body.name election   = long_date(@election.d) .nav - if @districts_in_this_election.size > 1 - @district_index = @districts_in_this_election.index(@district) - unless @district_index == 0 # Don't show the previous link if this is the first district for this election - @previous_district = @districts_in_this_election[@district_index - 1] %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@previous_district.slug}" }< «  = @previous_district.name     - unless @district_index == @districts_in_this_election.size - 1 # Don't show the next link if this is the last district for this election - @next_district = @districts_in_this_election[@district_index + 1] %a{ :href => "/bodies/#{@election.body.slug}/elections/#{@election.d}/#{@election.body.districts_name}/#{@next_district.slug}" }< = @next_district.name » %p %a{ :href => "/bodies/#{@district.body.slug}/#{@district.body.district_name.pluralize(2)}/#{@district.slug}" } All elections in = @district.name » %h1= @district.name + " " + @district.body.district_name %h2 Votes by party %table %tr.header %th   %th   %th   %th.right.highlight seats won %th candidates %th.right votes %th.right % votes - count = 0 - @results_by_party.each do |row| - count += 1 %tr %td.right= count %td{ :style => "background-color: #{row['party_colour'] }" }   %td= row['party_name'] %td.right.highlight= row['num_seats'] %td.right= row['num_candidates'] %td.right= commify(row['total_votes']) %td.right= format_percent(row['total_votes'].to_f / @total_votes * 100) %tr.footer %td   %td   %td   %td.right.highlight= @total_seats %td.right= @total_candidates %td.right= commify(@total_votes) %td   %h2 Votes by candidate %table %tr.header %th   %th   %th   %th   %th.right votes %th.right % votes %th   - count = 0 - for candidacy in @candidacies - count += 1 %tr.vcard %td= count %td{ :style => "background-color: #{candidacy.party.colour}" }   %td %span.candidate_name.fn %a{ :href => "/candidates/#{candidacy.candidate.id}" } = candidacy.candidate.short_name %td %span.candidate_party.org = candidacy.party.name %td.right= commify(candidacy.votes) %td.right= format_percent(candidacy.votes.to_f / @total_votes * 100) - if candidacy.seats == 1 %td.elected="Elected" - else %td   %tr.footer %td   %td   %td   %td   %td.right= commify(@total_votes) %td   %td