{% load fhadmin_module_groups i18n %}
{% fhadmin_group_list request %}

{% if group_list %}
<div class="groups">
{% for group, app_list in group_list %}
<div class="group">
    <h2>{% trans group %}</h2>
    {% for app in app_list %}
        <div class="module">
        <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
        <caption class="caption {{ app.name|lower }}"><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
        {% for model in app.models %}
            <tr>
            {% if model.perms.change %}
                <th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
            {% else %}
                <th scope="row">{{ model.name }}</th>
            {% endif %}

            {% if model.perms.add %}
                <td><a href="{{ model.admin_url }}add/" class="addlink">&nbsp;</a></td>
            {% else %}
                <td>&nbsp;</td>
            {% endif %}
            </tr>
        {% endfor %}
        </table>
        </div>
    {% endfor %}
</div>
{% endfor %}
</div>
<script type="text/javascript">
if (window.django && window.django.jQuery) {
    (function($){
        $(function(){
            $('head').append('<style type="text/css">#header h1:hover { cursor: pointer; }\x3C/style>');
            var quickpanel = $('#quickpanel');
            $('body').addClass('qp-active');
            $('#header h1').bind('click', function() {
                $('body').toggleClass('qp-open');
                quickpanel.slideToggle();
            });
        });
    })(django.jQuery);
}
</script>
{% else %}
    <p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}
