= render :partial => 'races/standard_parts'

- content_for :results do
  - if @instance.has_results?
    = render :partial => 'summary', :locals => {:splitting => true}
    %table.splits
      = render :partial => 'splits_header'
      %tbody
        = render :partial => 'race_performances/splits', :collection => @performances.completed
  - else
    %p.noresults
      Not available yet.

- content_for :chart do
  .performance_chart
    %ul.labels
      - @instance.checkpoints.each do |cp|
        %li= cp.name
    .chart_holder
      - if @club
        = link_to "loading club data", race_club_path(@instance.race, @instance, @club, :format => 'json'), :class => 'waiting'
      - elsif @category
        = link_to "loading category data", race_category_path(@instance.race, @instance, @category, :format => 'json'), :class => 'waiting'
      - else
        = link_to "loading results data", race_instance_path(@instance.race, @instance, :format => 'json'), :class => 'waiting'
    .chart_control

- content_for :breadhead do
  = link_to "Races", races_url, :class => 'breadhead'
  = t('race_results_extension.separator')
  = link_to @instance.race.name, race_url(@instance.race), :class => 'breadhead'
  = t('race_results_extension.separator')
  = link_to @instance.name, race_instance_url(@instance.race, @instance), :class => 'breadhead'

- content_for :title do
  = "#{@instance.full_name}: splits"

- content_for :introduction do
  - if @instance.past?
    = @instance.filter.filter(@instance.report)
  - else
    = @instance.filter.filter(@instance.notes)

- content_for :see_also do
  .see_also
    %p
      = link_to "#{@instance.full_name} results", race_instance_url(@race, @instance)
      %br
      - if others = @race.instances.with_results.select{|i| i != @instance}
        More 
        = @race.name
        results:
        = others.map { |instance| link_to instance.name, race_instance_url(@race, instance) }.join(', ') + '.'
        %br
      More races:
      = Race.except(@race).map {|race| link_to race.name, race_url(race) }.join(', ') + '.'



= yield :results
- if @club || @category
  = yield :chart
= yield :see_also