<%inherit file="/template.html" />
<%namespace name="components" file="/components.html"/>
<%def name="title()">${_("Admin: Group Permissions")}</%def>

<%def name="breadcrumbs()">
    ${_("Admin &raquo; Group Permissions")|n}
</%def>

<%block name="headline">

<div class="well">
    <h2>${_("Group Permissions")}</h2>

    <p>
    <strong>
        ${_("WARNING: This allows you to shut yourself out of your adhocracy. Handle with care!")}
    </strong>
    </p>
<form name="settings" class="inplace" method="POST" action="/admin/permissions">
    ${h.field_token()|n}

    <%
    groups = model.Group.all()
    %>
    <table border="0" id="permissions">
        <thead>
        <tr>
            <th></th>
            %for group in groups:
                <th class="group">
                    <p>${_(group.group_name)}</p>
                </th>
            %endfor
        </tr>
    </thead>
        %for permission in sorted(model.Permission.all(), key=lambda x: x.permission_name):
        <tr>
            <td>${permission.permission_name}</td>
            %for group in groups:
                <td>
                <input name="${group.code}-${permission.permission_name}"
                    value="True" type="checkbox" style="width: auto"
                    %if permission in group.permissions:
                        checked="checked"
                    %endif
                    />
                </td>
            %endfor
            </tr>
        %endfor
    </table>
    ${components.savebox(h.base_url("/admin"))}
</form>
</div>
</%block>
