{% extends 'base.html' %}

{% block nav_servers %}active{% endblock %}

{% block container %}
    <form id="serversForm">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
    </form>
    {{ super() }}
</form>
{% endblock %}

{% block sidebar %}
    <ul id="servers-list" class="nav ogcp-nav flex-column nav-pills">
        {% for server in servers %}
        {% set server_str = server["ip"] ~ ":" ~ server["port"] %}
            <li class="nav-item">
                <input class="form-check-input" type="checkbox" form="serversForm"
                       value="{{ server_str }}"
                       name="selected-server"
                       {% if loop.index == 1 %}checked{% endif %} />
                {{ server["name"] }}
            </li>
        {% endfor %}
    </ul>
{% endblock %}

{% block commands %}
{% if current_user.is_authenticated %}
  <input class="btn btn-light {% block nav_server_update %}{% endblock %}" type="submit" value="{{ _('Edit server') }}"
         form="serversForm" formaction="{{ url_for('server_update_get') }}" formmethod="get">
  {% if btn_back %}
    <button class="btn btn-danger ml-3" type="button" id="backButton" onclick="history.back()">
      {{ _("Back") }}
    </button>
  {% endif %}
{% endif %}
{% endblock %}

