{% extends 'snip/base.html.twig' %}

{% set title %}{{ snip }} - Versions{% endset %}
{% set active = 'versions' %}

{% block buttons %}
    <a href="{{ path('version_set', {version: snip.latestVersion.id, snip: snip.id}) }}" class="btn btn-warning">
        <i class="fa fa-refresh"></i> Latest
    </a>
    <a href="{{ path('content_compare', {to: snip.activeVersion.id}) }}" class="btn btn-info">
        <i class="fa fa-left-right"></i> Compare
    </a>
{% endblock %}

{% block cardbody %}
    <div class="list-group">
        {% for version in snip.snipContents|reverse %}
            <a class="list-group-item {% if version.id == snip.activeVersion.id %}list-group-item-success{% endif %} d-flex justify-content-between"
               href="{{ path('version_set', {version: version.id, snip: snip.id}) }}">
                <span>
                    {{ include('generic/datetime.badge.html.twig', {datetime: version.id.dateTime}) }}
                    {% if version.name %}{{ version.name }}{% endif %}
                </span>
                <span class="text-muted">{{ version.id }}</span>
            </a>
        {% endfor %}
    </div>
{% endblock %}