{% load i18n wagtailadmin_tags %}

{% if not page_perms %}
    {% page_permissions page as page_perms %}
{% endif %}

<form action="{% url page.locked|yesno:'wagtailadmin_pages:unlock,wagtailadmin_pages:lock' page.id %}" method="POST" class="lock-indicator {{ page.locked|yesno:'locked,unlocked' }}">
    {% trans "Edit lock" %}

    {% csrf_token %}
    <input type="hidden" name="next" value="{% url 'wagtailadmin_pages:edit' page.id %}" />
    <button type="submit" class="status-tag {{ page.locked|yesno:'primary,secondary' }}{% if not page_perms.can_lock %} disabled{% endif %}">
        {% if page.locked %}
            {% trans 'Locked' %}
        {% else %}
            {% trans 'Unlocked' %}
        {% endif %}
    </button>
</form>
