.nav
  %a{ :href => "/candidates" }
    &laquo; All candidates

%h1= @page_title = @candidate.name

%h2 Elections contested

%table
  %tr
    %th
    %th date
    %th party
    %th body
    %th district
    %th votes
    %th position
    %th
    
  - @candidate.candidacies.each do |ccy|
    %tr
      %td{ :style => "background-color: #{ccy.party.colour}" } &nbsp;
      %td
        %a{ :href => "/bodies/#{ccy.election.body.slug}/elections/#{ccy.election.d}" }
          = long_date(ccy.election.d)
      %td= ccy.party.name
      %td
        %a{ :href => "/bodies/#{ccy.election.body.slug}" }
          = ccy.election.body.name
      %td
        %a{ :href => "/bodies/#{ccy.election.body.slug}/elections/#{ccy.election.d}/#{ccy.district.body.districts_name}/#{ccy.district.slug}" }
          = ccy.district.name
          = ccy.district.body.district_name
      %td.right= commify(ccy.votes)
      %td.right= to_ordinal(ccy.position)
      %td= ccy.seats == 1 ? "Elected" : "Not elected"
      
.warning
  This might not be the complete electoral history for this candidate. They might have stood in elections outside Sutton and / or in Sutton elections for which we don't have data.
.nav
  %a{ :href => "/candidates" }
    &laquo; All candidates

%h1= @page_title = @candidate.name

%h2 Elections contested

%table
  %tr
    %th &nbsp;
    %th date
    %th party
    %th body
    %th district
    %th votes
    %th position
    %th &nbsp;
    
  - @candidate.candidacies.each do |ccy|
    %tr
      %td{ :style => "background-color: #{ccy.party.colour}" } &nbsp;
      %td
        %a{ :href => "/bodies/#{ccy.election.body.slug}/elections/#{ccy.election.d}" }
          = long_date(ccy.election.d)
      %td= ccy.party.name
      %td
        %a{ :href => "/bodies/#{ccy.election.body.slug}" }
          = ccy.election.body.name
      %td
        %a{ :href => "/bodies/#{ccy.election.body.slug}/elections/#{ccy.election.d}/#{ccy.district.body.districts_name}/#{ccy.district.slug}" }
          = ccy.district.name
      %td.right= commify(ccy.votes)
      %td.right= to_ordinal(ccy.position)
      %td= ccy.seats == 1 ? "Elected" : "Not elected"
      
.warning
  This might not be the complete electoral history for this candidate. They might have stood in elections outside Sutton and / or in Sutton elections for which we don't have data.
Remove "ward"/"constituency" to make table easier to read; make table easier to copy/paste
Remove "ward"/"constituency" to make table easier to read; make table easier to copy/paste
