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

Remove delete action from main actions menu

This commit is contained in:
Tidiane Dia 2021-12-15 11:49:00 +00:00 committed by Matt Westcott
parent 11e1ff03df
commit 76021a1716

View File

@ -292,24 +292,6 @@ class UnpublishMenuItem(ActionMenuItem):
return reverse('wagtailadmin_pages:unpublish', args=(context['page'].id,)) return reverse('wagtailadmin_pages:unpublish', args=(context['page'].id,))
class DeleteMenuItem(ActionMenuItem):
name = 'action-delete'
label = _("Delete")
icon_name = 'bin'
classname = 'action-secondary'
def is_shown(self, context):
if context['view'] == 'edit':
perms_tester = self.get_user_page_permissions_tester(context)
return (
not perms_tester.page_locked()
and perms_tester.can_delete()
)
def get_url(self, context):
return reverse('wagtailadmin_pages:delete', args=(context['page'].id,))
class LockMenuItem(ActionMenuItem): class LockMenuItem(ActionMenuItem):
name = 'action-lock' name = 'action-lock'
label = _("Lock") label = _("Lock")
@ -392,7 +374,6 @@ def _get_base_page_action_menu_items():
if BASE_PAGE_ACTION_MENU_ITEMS is None: if BASE_PAGE_ACTION_MENU_ITEMS is None:
BASE_PAGE_ACTION_MENU_ITEMS = [ BASE_PAGE_ACTION_MENU_ITEMS = [
SaveDraftMenuItem(order=0), SaveDraftMenuItem(order=0),
DeleteMenuItem(order=10),
LockMenuItem(order=15), LockMenuItem(order=15),
UnlockMenuItem(order=15), UnlockMenuItem(order=15),
UnpublishMenuItem(order=20), UnpublishMenuItem(order=20),