{% block content %}
    {% import 'sortable_table_macro.html.twig' as sortable %}

    <div class="pagination">
        {{ pagerfanta(torrents) }}
    </div>

    <table class="table table-hover" id="table-torrents-list">
        <thead class="thead-light">
        <tr>
            {{ sortable.sortable_columns({
                '<i class="fas fa-magnet"></i>': null,
                'Name': 'name',
                'Size': 'totalSize',
                'Discovered': 'discoveredOn'
            }) }}
        </tr>
        </thead>
        {# @var torrent \App\Magnetico\Entity\Torrent #}
        {% for torrent in torrents %}
        <tr>
            <td><a href="{{ magnet(torrent.infoHash, torrent.name) }}">&#128279;</a></td>
            <td><a href="{{ path('torrents_show', {'id': torrent.id}) }}">{{ torrent.name }}</a></td>
            <td>{{ torrent.totalSize | humanize_size }}</td>
            <td>{{ torrent.discoveredOn | date('Y-m-d H:i:s')}}</td>
        </tr>
        {% endfor %}
    </table>

    <div class="pagination">
        {{ pagerfanta(torrents) }}
    </div>
{% endblock %}