{% extends 'trosnoth/base.html' %}
{% load static %}
{% block head %}
  <title>{{ settings.serverName }}: {{ arena.name }}</title>
{% endblock %}

{% block main %}
  <div id="container">
    <h1><a href="/">{{ settings.serverName }}</a></h1>
    <h2>
      {% if loneArena %}Game Settings
      {% elif arena.pk %}Configure {{ arena.name }}
      {% else %}Configure new arena
      {% endif %}
    </h2>

    <ul class="messagelist">
      {% if message %}
      <li class="warning">{{ message }}</li>
      {% endif %}
    </ul>
    <form method="post">
      {% csrf_token %}
      <table>
        {% if info %}
          <tr><th>Status:</th><td>{{ info.status }}
            <a href="">[&nbsp;refresh&nbsp;]</a>
            {% if info.players %}<a href="{% url 'trosnoth:scenario' arenaId=arena.id %}">[&nbsp;start scenario&nbsp;]</a>{% endif %}
          </td></tr>
          {% if arena.enabled %}
            <tr><th>Players:</th><td>{{ info.players }}
              <a href="">[ refresh ]</a></td></tr>
            {{ controlForm.as_table }}
          {% endif %}
        {% endif %}
        {{ modelForm.as_table }}
      </table>
      <div class="submit-row">
        <input type="submit" class="default" value="Apply changes">
        {% if arena.pk and not loneArena %}
          <p class="deletelink-box"><a class="deletelink"
             href="{% url 'trosnoth:delarena' arenaId=arena.id %}">Delete</a>
          </p>
        {% endif %}
      </div>

    </form>
    {% if loneArena %}
      <div class="finalnote">To configure multiple arenas (allowing multiple
        concurrent games), <a href="{% url 'trosnoth:newarena' %}">click
        here</a>.</div>
    {% endif %}
  </div>
{% endblock %}
