0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Use page_perms directly instead of copying into template context

This commit is contained in:
Karl Hobley 2019-10-28 11:27:13 +00:00
parent 52638a1a6c
commit e4dfbac2b8
2 changed files with 2 additions and 4 deletions

View File

@ -18,8 +18,8 @@
<button
type="submit"
class="status-tag {{ page.locked|yesno:'primary,secondary' }}{% if not form_action %} disabled{% endif %}"
aria-label="{% if page_locked %}{% if user_can_unlock %}{% trans 'Remove editor lock. Current status: Locked' %}{% else %}{% trans 'Current status: Locked' %}{% endif %}{% else %}{% trans 'Apply editor lock. Current status: Unlocked' %}{% endif %}">
{% if page_locked %}
aria-label="{% if page_perms.page_locked %}{% if page_perms.can_unlock %}{% trans 'Remove editor lock. Current status: Locked' %}{% else %}{% trans 'Current status: Locked' %}{% endif %}{% else %}{% trans 'Apply editor lock. Current status: Unlocked' %}{% endif %}">
{% if page_perms.page_locked %}
{% trans "Locked" %}
{% elif user_has_lock %}
{% trans "Locked by you" %}

View File

@ -547,9 +547,7 @@ def edit(request, page_id):
'form': form,
'next': next_url,
'has_unsaved_changes': has_unsaved_changes,
'page_locked': page_locked,
'user_has_lock': user_has_lock,
'user_can_unlock': page_perms.can_unlock(),
})