{% extends 'moneta.html' %}
{% load i18n bootstrap3 moneta %}
{% block bootstrap3_title %}{% trans 'Index' %}{% endblock %}
{% block bootstrap3_content %}
    <div class="container">
        <!-- Example row of columns -->
        <div class="row">
            <div class="col-md-7">
                <h2>{% trans 'Available repositories' %}</h2>
                <ul class="nav nav-pills nav-stacked">
                    {% for repo in repositories %}
                        <li>
                            <h3><a href="{{ repo.get_absolute_url }}">{{ repo.name }}</a>
                                <span class="badge badge">{{ repo.package_count }} </span>
                                <small class="">
                                    {% with repotype=repo.get_archive_type_display author=repo.author %}{% blocktrans %}{{ repotype }} created by {{ author }}{% endblocktrans %}{% endwith %}
                                </small>
                            </h3>
                            <div class="btn-group">
                                <a class="btn btn-sm btn-default" href="{{ repo.get_absolute_url }}">{% trans 'usage' %}</a>
                                <a class="btn btn-sm btn-default" href="{% url 'moneta:search_package' rid=repo.id %}">{% trans 'browse repository' %}</a>
                                <a class="btn btn-sm btn-default" href="{% url 'moneta:compare_states' rid=repo.id %}">{% trans 'check' %}</a>
                                {% if repo.id in admin_ids %}
                                    <a class="btn btn-sm btn-default" href="{% url 'moneta:modify_repository' rid=repo.id %}">{% trans 'modify repository' %}</a>
                                    <a class="btn btn-sm btn-danger" href="{% url 'moneta:delete_repository' rid=repo.id %}">{% trans 'delete repository' %}</a>
                                {% endif %}
                            </div>
                        </li>
                    {% empty %}
                        <li>{% trans 'No available repositories' %}</li>
                    {% endfor %}
                </ul>
            </div>
            {% if form %}<div class="col-md-5">
                <h2>{% trans 'New repository' %}</h2>

                <form method="post" action="">
                    {% csrf_token %}
                    {% bootstrap_form form %}
                    <input class="btn btn-xs btn-primary" type="submit" value="{% trans 'Create a new repository' %}"/>
                </form>
            </div>{% endif %}
        </div>

{% endblock %}