0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Add unlock cta to lock message

This commit is contained in:
Dan Braghis 2020-06-18 16:16:42 +01:00 committed by Matt Westcott
parent 97e78f4ade
commit b08dcd6125

View File

@ -391,6 +391,11 @@ def edit(request, page_id):
else:
lock_message = format_html(_("<b>Page '{}' is locked</b> by <b>you</b>."), page.get_admin_display_title())
lock_message += format_html(
'<span class="buttons"><button class="button button-small button-secondary" data-locking-action="{}">{}</button></span>',
reverse('wagtailadmin_pages:unlock', args=(page.id,)),
_("Unlock")
)
messages.warning(request, lock_message, extra_tags='lock')
elif page.locked and page_perms.page_locked():
@ -402,6 +407,12 @@ def edit(request, page_id):
# Page was probably locked with an old version of Wagtail, or a script
lock_message = format_html(_("<b>Page '{}' is locked</b>."), page.get_admin_display_title())
if page_perms.can_unlock():
lock_message += format_html(
'<span class="buttons"><button class="button button-small button-secondary" data-locking-action="{}">{}</button></span>',
reverse('wagtailadmin_pages:unlock', args=(page.id,)),
_("Unlock")
)
messages.error(request, lock_message, extra_tags='lock')
# Check for revisions still undergoing moderation and warn - this is for the old moderation system