mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-20 10:45:29 +08:00
Making the admin menu collapsible once again
--HG-- branch : dev
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %>
|
|
||||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
|
||||||
|
|
||||||
<%--//todo: get the settings from the cookie to class-ify parts of the menu that should be closed on load--%>
|
|
||||||
<%--<ul id="navigation" role="navigation">
|
|
||||||
<%if (Model.Menu != null) {
|
|
||||||
foreach (var menuSection in Model.Menu) {
|
|
||||||
// todo: (heskew) need some help(er)
|
|
||||||
var firstSectionItem = menuSection.Items.FirstOrDefault();
|
|
||||||
var sectionHeaderMarkup = firstSectionItem != null
|
|
||||||
? Html.ActionLink(menuSection.Text, (string)firstSectionItem.RouteValues["action"], firstSectionItem.RouteValues).ToHtmlString()
|
|
||||||
: string.Format("<span>{0}</span>", Html.Encode(menuSection.Text));
|
|
||||||
var classification = "";
|
|
||||||
if (menuSection == Model.Menu.First())
|
|
||||||
classification = "first ";
|
|
||||||
if (menuSection == Model.Menu.Last())
|
|
||||||
classification += "last ";
|
|
||||||
|
|
||||||
%>
|
|
||||||
<li<%=!string.IsNullOrEmpty(classification) ? string.Format(" class=\"{0}\"", classification.TrimEnd()) : "" %>><h3><%=sectionHeaderMarkup %></h3><ul class="menuItems"><%foreach (var menuItem in menuSection.Items) { %>
|
|
||||||
<li><%: Html.ActionLink(menuItem.Text, (string)menuItem.RouteValues["action"], menuItem.RouteValues)%></li>
|
|
||||||
<%} %></ul></li>
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}%>
|
|
||||||
</ul>
|
|
||||||
<% using (this.Capture("end-of-page-scripts")) { %>
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function ($) {
|
|
||||||
$("#navigation h3").expandoControl(function(controller) { return controller.next(); }, { key: "N42", path: "<%:ResolveUrl("~/") %>" });
|
|
||||||
})(jQuery);
|
|
||||||
</script>
|
|
||||||
<% } %>--%>
|
|
@@ -1,14 +1,44 @@
|
|||||||
<ul id="navigation">
|
@using System.Web.Routing;
|
||||||
|
@{
|
||||||
|
Script.Require("jQuery");
|
||||||
|
Script.Include("admin.js");
|
||||||
|
IEnumerable<dynamic> firstLevelMenuItems = Model;
|
||||||
|
}
|
||||||
|
<ul id="navigation" role="navigation">
|
||||||
@foreach(var firstLevelMenuItem in Model) {
|
@foreach(var firstLevelMenuItem in Model) {
|
||||||
<li>
|
IEnumerable<dynamic> secondLevelMenuItems = firstLevelMenuItem;
|
||||||
<h3><a href="#">@firstLevelMenuItem.Text</a></h3>
|
|
||||||
|
var firstOfTheSecond = secondLevelMenuItems.FirstOrDefault();
|
||||||
|
var sectionHeaderMarkup = firstOfTheSecond != null
|
||||||
|
? Html.ActionLink((string)firstLevelMenuItem.Text, (string)firstOfTheSecond.RouteValues["action"], (RouteValueDictionary)firstOfTheSecond.RouteValues)
|
||||||
|
: new HtmlString(string.Format("<span>{0}</span>", Html.Encode(firstLevelMenuItem.Text)));
|
||||||
|
|
||||||
|
if (firstLevelMenuItem == firstLevelMenuItems.First()) {
|
||||||
|
firstLevelMenuItem.Classes.Add("first");
|
||||||
|
}
|
||||||
|
if (firstLevelMenuItem == firstLevelMenuItems.Last()) {
|
||||||
|
firstLevelMenuItem.Classes.Add("last");
|
||||||
|
}
|
||||||
|
|
||||||
|
var firstLevelTag = Tag(firstLevelMenuItem, "li");
|
||||||
|
@firstLevelTag.StartElement
|
||||||
|
<h3>@sectionHeaderMarkup</h3>
|
||||||
<ul class="menuItems">
|
<ul class="menuItems">
|
||||||
@foreach(var secondLevelMenuItem in firstLevelMenuItem) {
|
@foreach(var secondLevelMenuItem in secondLevelMenuItems) {
|
||||||
<li>
|
<li>
|
||||||
<a href="@secondLevelMenuItem.Href">@secondLevelMenuItem.Text</a>
|
<a href="@secondLevelMenuItem.Href">@secondLevelMenuItem.Text</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
@firstLevelTag.EndElement
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
@using(Script.Foot()) {
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
(function ($) {
|
||||||
|
$("#navigation h3").expandoControl(function(controller) { return controller.next(); }, { key: "N42", path: "@Url.Content("~/")" });
|
||||||
|
})(jQuery);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
}
|
@@ -68,6 +68,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="TheThemeMachine\Views\User.cshtml" />
|
<Content Include="TheThemeMachine\Views\User.cshtml" />
|
||||||
|
<None Include="TheAdmin\Views\Menu.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="TheAdmin\Styles\images\icons.png" />
|
<Content Include="TheAdmin\Styles\images\icons.png" />
|
||||||
|
Reference in New Issue
Block a user