mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Fix for bug #16249
- Making removal of a menu item tied to a content item not remove that content item, instead the OnMainMenu bit is flipped - Changing the text of the remove button to be either "Remove" (for items tied to content) or "Delete" (for standalone items) --HG-- branch : dev
This commit is contained in:
@@ -108,8 +108,12 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
|
||||
MenuPart menuPart = _menuService.Get(id);
|
||||
|
||||
if (menuPart != null)
|
||||
_menuService.Delete(menuPart);
|
||||
if (menuPart != null) {
|
||||
if (menuPart.Is<MenuItem>())
|
||||
_menuService.Delete(menuPart);
|
||||
else
|
||||
menuPart.OnMainMenu = false;
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
@@ -26,8 +26,8 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<tr>
|
||||
<td><input type="text" class="text-box" name="<%=Html.NameOf(m => m.MenuItemEntries[i].MenuItem.Text) %>" value="<%=menuPartEntry.MenuItem.Text %>" /></td>
|
||||
<td><input type="text" class="text-box" name="<%=Html.NameOf(m => m.MenuItemEntries[i].MenuItem.Position) %>" value="<%=menuPartEntry.MenuItem.Position %>" /></td>
|
||||
<td><% if (!menuPartEntry.IsMenuItem) { %><input type="text" class="text-box" disabled="disabled" value="<%=menuPartEntry.MenuItem.Url %>" /><% } else { %><input type="text" class="text-box" name="<%=Html.NameOf(m => m.MenuItemEntries[i].MenuItem.Url) %>" value="<%=menuPartEntry.MenuItem.Url %>" /><% } %></td>
|
||||
<td><input type="hidden" name="<%=Html.NameOf(m => m.MenuItemEntries[i].MenuItemId) %>" value="<%=menuPartEntry.MenuItemId %>" /><a href="<%=Url.Action("Delete", new {id = menuPartEntry.MenuItemId, __RequestVerificationToken = Html.AntiForgeryTokenValueOrchard()}) %>" class="remove button">delete</a></td>
|
||||
<td><% if (!menuPartEntry.IsMenuItem) { %><input type="text" class="text-box disabled" disabled="disabled" value="<%=menuPartEntry.MenuItem.Url %>" /><% } else { %><input type="text" class="text-box" name="<%=Html.NameOf(m => m.MenuItemEntries[i].MenuItem.Url) %>" value="<%=menuPartEntry.MenuItem.Url %>" /><% } %></td>
|
||||
<td><input type="hidden" name="<%=Html.NameOf(m => m.MenuItemEntries[i].MenuItemId) %>" value="<%=menuPartEntry.MenuItemId %>" /><a href="<%=Url.Action("Delete", new {id = menuPartEntry.MenuItemId, __RequestVerificationToken = Html.AntiForgeryTokenValueOrchard()}) %>" class="remove"><%=_Encoded(menuPartEntry.IsMenuItem ? "Delete" : "Remove") %></a></td>
|
||||
</tr><%
|
||||
++menuPartEntryIndex;
|
||||
} %>
|
||||
|
Reference in New Issue
Block a user