Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display removed menu items in menu or menu item delete modal
Anna Siwika3c2422246aa
diff --git a/saleor/dashboard/menu/views.py b/saleor/dashboard/menu/views.pyindex c5b256e211..23dce787d0 100644--- a/saleor/dashboard/menu/views.py+++ b/saleor/dashboard/menu/views.py@@ -80,7 +80,8 @@ def menu_delete(request, pk):msg = pgettext_lazy('Dashboard message', 'Removed menu %s') % (menu,)messages.success(request, msg)return redirect('dashboard:menu-list')- ctx = {'menu': menu, 'menu_items_count': menu.items.count()}+ ctx = {+ 'menu': menu, 'descendants': list(menu.items.all())}return TemplateResponse(request, 'dashboard/menu/modal/confirm_delete.html', ctx)@@ -153,7 +154,7 @@ def menu_item_delete(request, menu_pk, item_pk):else redirect(redirect_url))ctx = {'menu_item': menu_item,- 'menu_items_count': len(menu_item.get_descendants())}+ 'descendants': list(menu_item.get_descendants())}return TemplateResponse(request, 'dashboard/menu/item/modal/confirm_delete.html', ctx)diff --git a/templates/dashboard/menu/item/modal/confirm_delete.html b/templates/dashboard/menu/item/modal/confirm_delete.htmlindex 3d6476fcf0..8085d1f23a 100644--- a/templates/dashboard/menu/item/modal/confirm_delete.html+++ b/templates/dashboard/menu/item/modal/confirm_delete.html@@ -1,7 +1,6 @@{% extends "dashboard/base_modal.html" %}{% load i18n %}-{% load mptt_tags %}{% block form_class %}{% endblock %}@@ -20,13 +19,12 @@{% blocktrans trimmed with menu_item=menu_item menu=menu_item.menu context "Remove menu item modal title" %}Are you sure you want to remove menu item <strong>{{ menu_item }}</strong> from {{ menu }} menu?{% endblocktrans %}- {% if menu_items_count %}+ {% if descendants %}<p>- {% blocktrans count counter=menu_items_count trimmed context "Remove menu item form text about menu items" %}- There is one menu item in this menu item that will be removed.- {% plural %}- There are {{ counter }} menu items in this menu item that will be removed.- {% endblocktrans %}+ {% trans "The following menu items will be removed:" context "Remove menu modal text about descendant menu items" %}+ <ul>+ {{ descendants|join:", " }}+ </ul></p>{% endif %}</div>diff --git a/templates/dashboard/menu/modal/confirm_delete.html b/templates/dashboard/menu/modal/confirm_delete.htmlindex ed88a641ea..553dc08440 100644--- a/templates/dashboard/menu/modal/confirm_delete.html+++ b/templates/dashboard/menu/modal/confirm_delete.html@@ -1,7 +1,6 @@{% extends "dashboard/base_modal.html" %}{% load i18n %}-{% load mptt_tags %}{% block form_class %}{% endblock %}@@ -20,13 +19,12 @@{% blocktrans trimmed with menu=menu context "Remove menu modal title" %}Are you sure you want to remove menu <strong>{{ menu }}</strong>?{% endblocktrans %}- {% if menu_items_count %}+ {% if descendants %}<p>- {% blocktrans count counter=menu_items_count trimmed context "Remove menu form text about menu items" %}- There is one menu item in this menu that will be removed.- {% plural %}- There are {{ counter }} menu items in this menu that will be removed.- {% endblocktrans %}+ {% trans "The following menu items will be removed:" context "Remove menu modal text about descendant menu items" %}+ <ul>+ {{ descendants|join:", " }}+ </ul></p>{% endif %}</div>