{% extends "base.html" %}

{% block title %} | Subsets{% endblock %}

{% block main %}
        <div class="page-header">
            <div class="container">
                <h1 class="smaller"><a href="{% url 'admin:project_overview' project.id %}">{{project.name}}</a></h1>
                <ul class="nav nav-tabs header-nav">
                    <li role="presentation"><a href="{% url 'admin:project_overview' project.id %}">Project home</a></li>
                    <li role="presentation"><a href="{% url 'admin:category_list' project.id %}">Categories</a></li>
                    <li role="presentation"><a href="{% url 'admin:usergroup_list' project.id %}">User groups</a></li>
                    <li role="presentation" class="active"><a href="{% url 'admin:subset_list' project.id %}">Subsets</a></li>
                    <li role="presentation"><a href="{% url 'admin:project_extend' project.id %}">Geographic extent</a></li>
                    <li role="presentation"><a href="{% url 'admin:project_settings' project.id %}">Settings</a></li>
                </ul>
            </div>
        </div>

        <div class="container">
            {% include 'snippets/messages.html' %}

            <div class="row">
                <div class="col-sm-8">
                    <h3 class="header">
                        Subsets
                        {% if project.subsets.all %}
                        <a href="{% url 'admin:subset_create' project.id %}" class="btn btn-success btn-sm pull-right"><span class="glyphicon glyphicon-plus"></span> Create new subset</a>
                        {% endif %}
                    </h3>

                    {% for subset in project.subsets.all %}
                    {% if forloop.first %}
                    <ul class="list-unstyled overview-list" id="sortable">
                    {% endif %}

                        <li>
                            <h4><a href="{% url 'admin:subset_data' project.id subset.id %}">{{subset.name}}</a></h4>
                            {% if subset.description %}<p>{{subset.description}}</p>{% endif %}
                        </li>


                    {% if forloop.last %}
                    </ul>
                    {% endif %}

                    {% empty %}
                    <div class="well empty-list">
                        <p class="lead">We couldn't find any subsets for this project.</p>
                        <a href="{% url 'admin:subset_create' project.id %}" class="btn btn-success btn-lg">Create new subset</a>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
{% endblock %}
