{% extends "/pyshop/layout.html" %}

{% block subnav %}
    <a href="{{ route_url('list_package')}}">
        {% trans %}package{% endtrans %}
    </a>
    <h2>{{package.name}}</h2>
{% endblock %}

{% set release = package.sorted_releases[0] %}

{% block main %}
<section id="release-download" class="release-download">
    <h5>download</h5>
    <a class="anchor" href="#release-files">&darr;</a>
    {% for f in release.files %}
        {% if f.package_type == 'sdist' %}
            <a class="download"
               href="{{ route_url('repository', file_id=f.id, filename=f.filename)
                       }}#{{ f.md5_digest }}">{{f.filename}}</a>
        {% endif %}
    {% endfor %}
</section>


<section id="release-summary" class="release-summary">
    <h5> {{ release.summary }} </h5>
    <ul class="classifiers">
        {% for c in release.classifiers %}
            <li>{{c.name}}</li>
        {% endfor %}
    </ul>
    <div> {{ parse_rest(release.description) }} </div>
</section>

<section id="release-files" class="release-files">
    <h5>{% trans %}release files{% endtrans %}</h5>
    <table>
        <colgroup>
            <col class="label"></col>
            <col class="version"></col>
            <col class="author"></col>
            <col class="download"></col>
        </colgroup>
        <tr>
            <th>{% trans %} files {% endtrans %}</th>
            <th>{% trans %} version {% endtrans %}</th>
            <th>{% trans %} author {% endtrans %}</th>
            <th>{% trans %} downloads {% endtrans %}</th>
        </tr>
        {% for release in package.sorted_releases %}
        <tr>
            <td>
                {% for f in release.files %}
                    <a class="download"
                       href="{{ route_url('repository', file_id=f.id,
                                filename=f.filename)
                               }}#{{ f.md5_digest }}">{{f.filename}}
                    </a>
                {% endfor %}
            </td>
            <td class="num">
                v{{ release.version }}
            </td>
            <td>
                {{ release.author.login }}
            </td>
            <td class="num">{{ release.downloads }}</td>
        </tr>
        {% endfor %}
    </table>
</section
{% endblock %}
