mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Preserving current menu on item deletion
--HG-- branch : 1.5.x
This commit is contained in:
@@ -113,8 +113,11 @@ namespace Orchard.Core.Navigation.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
MenuPart menuPart = _menuService.Get(id);
|
MenuPart menuPart = _menuService.Get(id);
|
||||||
|
int? menuId = null;
|
||||||
|
|
||||||
if (menuPart != null) {
|
if (menuPart != null) {
|
||||||
|
menuId = menuPart.Menu.Id;
|
||||||
|
|
||||||
// if the menu item is a concrete content item, don't delete it, just unreference the menu
|
// if the menu item is a concrete content item, don't delete it, just unreference the menu
|
||||||
if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype") || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") {
|
if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype") || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") {
|
||||||
menuPart.Menu = null;
|
menuPart.Menu = null;
|
||||||
@@ -124,7 +127,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index", new { menuId });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||||
|
|||||||
Reference in New Issue
Block a user