{% load artifacts %}
{% regroup artifacts by category as artifact_categories %}
{% for category in artifact_categories %}
    <div class="card">
        <div class="card-header">
            <span class="bi bi-{{ category.grouper|artifact_icon_name }}"></span>
            {{ category.grouper|artifact_category_label|capfirst }}
        </div>
        <ul class="list-group list-group-flush">
            {% for artifact in category.list %}
                <li class="list-group-item d-flex justify-content-between">
                    <a class="text-decoration-none"
                       href="{% url "artifacts:detail" artifact_id=artifact.id %}">
                        <small class="text-break">{{ artifact.get_label }}</small>
                    </a>
                    <div class="ms-1">
                        <div class="btn-group btn-group-sm"
                             role="group"
                             aria-label="Artifact quick actions">
                            <a class="btn btn-outline-secondary"
                               title="View"
                               href="{% url "artifacts:detail" artifact_id=artifact.id %}">
                                <span class="bi bi-search"></span>
                            </a>
                            <a class="btn btn-outline-secondary"
                               title="Download"
                               href="{% url "artifacts:download" artifact_id=artifact.id %}?archive=tar.gz">
                                <span class="bi bi-file-earmark-arrow-down"></span>
                            </a>
                        </div>
                    </div>
                </li>
            {% endfor %}
        </ul>
    </div>
{% endfor %}
