{% extends "base.html" %}

{% block title %} | {{group.name}}{% endblock %}
{% block bodydata %} data-project-id="{{group.project.id}}" data-group-id="{{group.id}}"{% endblock %}

{% block main %}
        <div class="page-header">
            <div class="container">
                <div class="row">
                    <div class="col-sm-6">
                        <h1 class="smaller"><a href="{% url 'admin:project_overview' group.project.id %}">{{group.project.name}}</a></h1>
                        <a href="{% url 'admin:project_overview' group.project.id %}"><span class="glyphicon glyphicon-arrow-left"></span> Project home page</a>
                    </div>
                    <ul class="header-nav">
                        <li><a href="{% url 'admin:category_list' group.project.id %}">Categories <span class="badge">{{ group.project.categories.count }}</span></a></li>
                        <li class="active"><a href="{% url 'admin:usergroup_list' group.project.id %}">User groups <span class="badge">{{ group.project.usergroups.count }}</span></a></li>
                    </ul>
                </div>
            </div>
        </div>

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

            <div class="row">
                <div class="col-sm-4">
                <div class="panel panel-default">
                        <div class="panel-heading">
                            <h6 class="item-info">User group</h6>
                            <h3>{{ group.name }}</h3>
                            {% if group.description %}<p>{{ group.description|linebreaksbr }}</p>{% endif %}
                        </div>
                        <div class="list-group">
                            <a href="{% url 'admin:usergroup_overview' group.project.id group.id %}" class="list-group-item active">Members</a>
                            <a href="{% url 'admin:usergroup_permissions' group.project.id group.id %}" class="list-group-item">Permissions</a>
                            <a href="{% url 'admin:usergroup_data' group.project.id group.id %}" class="list-group-item">Data</a>
                            <a href="{% url 'admin:usergroup_settings' group.project.id group.id %}" class="list-group-item">Settings</a>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8" id="members">
                    {% include 'snippets/usergroup-editor.html' with users=group.users.all %}
                </div>
            </div>
        </div>
{% endblock %}

{% block libraries %}
            <script src="/static/lib/handlebars/handlebars.js"></script>
            <script src="/static/js/templates.js"></script>

            <script src="/static/js/admin.control.ajax.js"></script>
            <script src="/static/js/admin.ui.usergroup.users.js"></script>
{% endblock %}
