<div id="team-profile">
  <h1 class="fancy">
    <span>
      <%= link_to (h @contester.team.name), team_url(@contester.team, team: 'matches', anchor: "contest_#{@contester.contest.id}") %>
    </span>
  </h1>

  <% if @contester.team.logo %>
    <div class="logo">
      <%= image_tag @contester.team.logo.url, class: 'logo', alt: h(@contester.team.name) %>
    </div>
  <% end %>
</div>

<h4 class="nane"><%= namelink @contester.contest %></h4>

<div id="matches" class="tabbed">
  <ul id="matches-nav" class="tabs">
    <li><a href="#results">Results</a></li>
    <li><a href="#upcoming">Upcoming</a></li>
    <li><a href="#info>">Info</a></li>
  </ul>

  <div class="tabbed-contents">
    <div class="tab" id="results">
      <%= render partial: 'matches/list', locals: { matches: @results, friendly: @contester.team, contest: false } %>
    </div>

    <div class="tab" id="results">
      <h3>Upcoming</h3>

      <table class="data">
        <tr>
          <th>Opponent</th>
          <th>Date</th>
          <th>Maps</th>
          <th>Server</th>
        </tr>

        <% @matches.each do |match| %>
          <% match.friendly = @contester.team %>
          <tr>
            <td><%= namelink match.get_opponent %></td>
            <td><%= link_to shorttime(match.match_time), match %></td>
            <td><%= namelink match.map1 %>, <%= namelink match.map2 %></td>
            <td><%= namelink match.server %></td>
          </tr>
        <% end %>
      </table>
    </div>

    <div class="tab" id="info">
      <h3>Rank</h3>
      <%= cascade @contester, ["total", "win", "loss", "draw"] %>

      <% if !@contester.active %>
        <p><strong>INACTIVE</strong></p>
      <% end %>
    </div>
  </div>
</div>

<div class="members">
  <h3>Members</h3>
  <%= render partial: 'teamers/list', locals: { teamers: @members, blacklist: nil, comment: false } %>
</div>

<% if @contester.can_update? cuser %>
  <%= link_to 'Edit', edit_contester_path(@contester), class: 'button' %>
<% end %>

<script type="text/javascript">
  new Yetii({
    id: 'matches'
  });
</script>