mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Fixing an issue with getting the current menu items for management
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<NavigationManagementViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Navigation.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Core.Navigation.ViewModels"%><%
|
||||
var menu = Model.Menu.FirstOrDefault(); %>
|
||||
<h1><%=Html.TitleForPage(T("Edit Main Menu").ToString())%></h1><%
|
||||
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<table>
|
||||
@@ -12,7 +13,7 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><%
|
||||
foreach (var menuItem in Model.Menu) { %>
|
||||
foreach (var menuItem in menu.Items) { %>
|
||||
<tr>
|
||||
<td><%=Html.TextBox("text", menuItem.Text) %></td>
|
||||
<td><%=Html.TextBox("position", menuItem.Position) %></td>
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BaseViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<% var menu = Model.Menu.FirstOrDefault();
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%><%
|
||||
var menu = Model.Menu.FirstOrDefault();
|
||||
if (menu != null && menu.Items.Count() > 0) { %>
|
||||
<div id="menucontainer">
|
||||
<%-- todo: (heskew) *really* need a better way of doing this. ...and this is really, really ugly :) --%>
|
||||
<ul id="menu">
|
||||
<%
|
||||
<%-- TODO: (erikpo) Really need a partial for rendering lists (and it should be templatable) to fix the above todo :) --%>
|
||||
<ul id="menu"><%
|
||||
int counter = 0, count = menu.Items.Count() - 1;
|
||||
foreach (var menuItem in menu.Items) {
|
||||
var sbClass = new StringBuilder(10);
|
||||
@@ -15,10 +15,9 @@
|
||||
sbClass.Append("last ");%>
|
||||
<li class="<%=sbClass.ToString().TrimEnd() %>"><%=!string.IsNullOrEmpty(menuItem.Url)
|
||||
? Html.Link(menuItem.Text, ResolveUrl(menuItem.Url))
|
||||
: Html.ActionLink(menuItem.Text, (string)menuItem.RouteValues["action"], menuItem.RouteValues).ToHtmlString() %></li>
|
||||
<%
|
||||
: Html.ActionLink(menuItem.Text, (string)menuItem.RouteValues["action"], menuItem.RouteValues).ToHtmlString() %></li><%
|
||||
++counter;
|
||||
} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% } %>
|
||||
</div><%
|
||||
} %>
|
Reference in New Issue
Block a user