{% extends "layout.html" %}

{% block head_title %}
{{ super() }} | Versions
{% endblock %}

{% block content %}
    <h1>Minecraft versions</h1>
    <hr />
    <table class="table table-condensed table-hover">
        <thead>
            <tr>
                <th><div class="text-center">Status</div></th>
                <th nowrap="nowrap"><div class="text-center">Version number</div></th>
                <th><div class="text-center">Release date</div></th>
                <th>Downloads</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            {% for item in page.object_list %}
            <tr>
                <td>
                   <div class="text-center">{{ item.status }}</div>
                </td>
                <td nowrap="nowrap" width="20%">
                    <div class="text-center">{{ item.version_number }} </div>
                </td>
                <td>
                    <div class="text-center">{{ item.date }}</div>
                </td>
                <td>
                    {% if item.jarfiles %}
                        {% for jarfile in item.jarfiles %}
                            <a href="{{ jarfile.url }}" class="btn btn-info btn-small">{{ jarfile.description|capitalize }}</a>&nbsp;
                        {% endfor %}
                    {% endif %}
                </td>
                <td>
                    <div class="text-right">
                        {% if item.status == 'release' %}
                            <a href="{{ url('version_release', item.version_number)}}">More details &raquo;</a>
                        {% else %}
                            <a href="{{ url('version', item.status, item.version_number)}}">More details &raquo;</a>
                        {% endif %}
                    </div>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    <div class="pagination pagination-centered">
        <ul>
            {% for p in range(1, paginator.num_pages+1) %}
            <li {% if p == page_number %}class="active"{% endif %}>
                <a href="{{ url('version_list') }}?page={{ p }}">{{ p }}</a>
            </li>
            {% endfor %}
        </ul>
    </div>
{% endblock %}
