{% extends "wagtailadmin/base.html" %}
{% load wagtailusers_tags wagtailimages_tags static compress i18n %}

{% block titletag %}{% trans "Add group" %}{% endblock %}
{% block bodyclass %}menu-groups{% endblock %}

{% block extra_css %}
    {% compress css %}
        <link rel="stylesheet" href="{% static 'wagtailusers/css/groups_edit.css' %}" type="text/css" />
    {% endcompress %}
{% endblock %}

{% block content %}

    {% trans "Add group" as add_group_str %}
    {% include "wagtailadmin/shared/header.html" with title=add_group_str icon="group" %}
    
    <div class="nice-padding">
        <form action="{% url 'wagtailusers_groups:add' %}" method="POST">
            {% csrf_token %}
            
            <ul class="fields">
                {% include "wagtailadmin/shared/field_as_li.html" with field=form.name %}
                <li>
                    {% format_permissions permission_bound_field=form.permissions %}
                </li>
                <li>
                    {% include "wagtailusers/groups/includes/page_permissions_formset.html" with formset=formset only %}
                </li>
                <li><input type="submit" value='{% trans "Add group" %}' /></li>
            </ul>
        </form>
    </div>
{% endblock %}

{% block extra_js %}
    {% include "wagtailadmin/pages/_editor_js.html" %}

    <script>
        {% include "wagtailusers/groups/includes/page_permissions_formset.js" with formset=formset only %}
    </script>
{% endblock %}
