{% extends "base.html" %}
{% import "macros.html" as utils %}

{% block title %}Bioregistry - Collections{% endblock %}

{% block container %}
    <div class="card">
        <div class="card-header">
            <div class="row align-items-center">
                <div class="col-8"><h5 style="margin: 0">Collections</h5></div>
                <div class="col-4 text-right">
                    <div class="dropdown">
                        <button class="btn btn-sm btn-outline-dark dropdown-toggle" type="button"
                                id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true"
                                aria-expanded="false">
                            Download
                        </button>
                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                            {% for label, key in formats %}
                                <a class="dropdown-item"
                                   href="{{ url_for("api.collections", format=key) }}">
                                    {{ label }} <i class="fas fa-download"></i>
                                </a>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card-body">
            <p>
                Collections are curated lists of prefixes along with a description of what the list is for. For example,
                there's a <a href="{{ url_for(".collection", identifier="0000001") }}">collection</a> that lists all
                of the resources from the review article <i><a href="https://doi.org/10.1002/1873-3468.14067">Sharing
                biological data: why, when, and how</a></i>. There's also a
                <a href="{{ url_for(".collection", identifier="0000002") }}">collection</a> comprising semantic web
                prefixes.
            </p>
            <p>New collections can be added in one of the following ways:</p>
            <ul>
                <li>Edit the <a
                        href="https://github.com/bioregistry/bioregistry/edit/main/src/bioregistry/data/collections.json">collections.json</a>
                    file with the GitHub editor.
                </li>
                <li>
                    Make a pull request to <a href="https://github.com/bioregistry/bioregistry">
                    <i class="fab fa-github"></i> bioregistry/bioregistry</a>.
                </li>
            </ul>
        </div>
        <table id="table-entries" class="table table-striped table-hover ">
            <thead>
            <tr>
                <td>Name</td>
                <td>Size</td>
                <td>Description</td>
            </tr>
            </thead>
            {% for identifier, row in rows %}
                <tr>
                    <td>
                        <a href="{{ url_for('ui.collection', identifier=identifier) }}">{{ row.name }}</a>
                    </td>
                    <td class="text-right">{{ row.resources | length }}</td>
                    <td><small>{{ row.description }}</small></td>
                </tr>
            {% endfor %}
        </table>
    </div>
{% endblock %}
