{% extends 'trosnoth/base.html' %}
{% block head %}
  <title>{{ settings.serverName }} :: Game Records</title>
{% endblock %}

{% block main %}
  <div id="container">
    <h1><a href="/">{{ settings.serverName }}</a></h1>
    {% for tournament in tournaments %}
      {% if tournament.matches.all %}
        <h2>{{ tournament.name }}<div class="small">[
        <a href="{% url 'trosnoth:tournament' tournamentId=tournament.pk %}">
          View tournament standings</a> ]</div></h2>
        {% for game in tournament.matches.all %}
          <a href="{% url 'trosnoth:viewgame' gameId=game.pk %}">
            #{{ game.pk }}: {{ game.scenario|default:"Game" }}</a>:
          {{ game.blueTeamName }} vs. {{game.redTeamName }},
          {{ game.getScoreString }},
          {{ game.started }}<br>
        {% endfor %}
      {% endif %}
    {% endfor %}
    <h2>All Games</h2>
    {% if games|length == 0 %}
      <p>No saved games on this server.</p>
    {% endif %}
    {% for game in games %}
      <a href="{% url 'trosnoth:viewgame' gameId=game.pk %}">
        #{{ game.pk }}: {{ game.scenario|default:"Game" }}</a>:
      {{ game.blueTeamName }} vs. {{game.redTeamName }},
      {{ game.getScoreString }},
      {{ game.started }}<br>
    {% endfor %}
  </div>
{% endblock %}
