{% load i18n %}

<fieldset>
    <legend class="visuallyhidden">{% trans "Permissions" %}</legend>
    <h2>{% trans "Object permissions" %}</h2>
    <table class="listing">
        <col />
        <col width="15%" />
        <col width="15%" />
        <col width="15%" />
        <thead>
            <tr>
                <th>{% trans "Name" %}</th>
                <th>{% trans "Add" %}</th>
                <th>{% trans "Change" %}</th>
                <th>{% trans "Delete" %}</th>
            </tr>
        </thead>
        <tbody>
            {% for content_perms_dict in object_perms %}
            <tr>
                <td class="title"><h3>{{ content_perms_dict.object|capfirst }}</h3></td>
                <td>
                    {% if content_perms_dict.add %}
                        <label for="{{ content_perms_dict.add.checkbox.id_for_label }}" class="visuallyhidden">{{ content_perms_dict.add.perm.name }}</label>
                        {{ content_perms_dict.add.checkbox.tag }}
                    {% endif %}
                </td>
                <td>
                    {% if content_perms_dict.change %}
                        <label for="{{ content_perms_dict.change.checkbox.id_for_label }}" class="visuallyhidden">{{ content_perms_dict.change.perm.name }}</label>
                        {{ content_perms_dict.change.checkbox.tag }}
                    {% endif %}
                </td>
                <td>
                    {% if content_perms_dict.delete %}
                        <label for="{{ content_perms_dict.delete.checkbox.id_for_label }}" class="visuallyhidden">{{ content_perms_dict.delete.perm.name }}</label>
                        {{ content_perms_dict.delete.checkbox.tag }}
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    <h2>{% trans "Other permissions" %}</h2>
    <table class="listing">
        <col />
        <col width="45%" />
        <thead>
            <tr>
                <th>{% trans "Name" %}</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            {% for perm_tuple in other_perms %}
                <tr>
                    <td class="title"><label for="{{ perm_tuple.1.id_for_label }}" class="plain-checkbox-label">{{ perm_tuple.0.name }}</label></td>
                    <td>
                        {{ perm_tuple.1.tag }}
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
</fieldset>
