{% load i18n %}

<h2 class="first-heading">
    {% trans 'Permissions' %}
</h2>

<form action="{% url lfc_update_portal_permissions %}"
      method="post">

    <table class="lfs-manage-table full">
        <tr>
            <th class="middle">{% trans "Permission" %}</th>
            {% for role in roles %}
                <th class="middle">{{ role.name }}</th>
            {% endfor %}
        </tr>
        {% for permission in permissions %}
            <tr>
                <td>{% trans permission.name %}</td>
                {% for role in permission.roles %}
                    <td><input type="checkbox" name="permission" value="{{ role.id }}|{{ permission.codename }}" {% if role.has_permission %}checked="checked"{% endif %}/></td>
                {% endfor %}
            </tr>
        {% endfor %}
    </table>

    <input class="ajax-save-button"
           type="submit" name="paste" value="{% trans 'Save permissions' %}" />
</form>