mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 19:24:03 +08:00
Adding Breadcrumb shape
--HG-- branch : 1.x
This commit is contained in:
parent
7ef63f3164
commit
93ea959504
@ -54,7 +54,9 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
var routeData = _workContextAccessor.GetContext().HttpContext.Request.RequestContext.RouteData;
|
||||
|
||||
var selectedPath = NavigationHelper.SetSelectedPath(menuItems, routeData);
|
||||
;
|
||||
|
||||
dynamic menuShape = shapeHelper.Menu();
|
||||
|
||||
if (part.Breadcrumb) {
|
||||
menuItems = selectedPath;
|
||||
foreach (var menuItem in menuItems) {
|
||||
@ -66,6 +68,8 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
if (part.Levels > 0) {
|
||||
menuItems = menuItems.Take(part.Levels);
|
||||
}
|
||||
|
||||
menuShape = shapeHelper.Breadcrumb();
|
||||
}
|
||||
else {
|
||||
IEnumerable<MenuItem> topLevelItems = menuItems.ToList();
|
||||
@ -103,8 +107,8 @@ namespace Orchard.Core.Navigation.Drivers {
|
||||
menuItems = topLevelItems;
|
||||
}
|
||||
}
|
||||
|
||||
dynamic menuShape = shapeHelper.Menu().MenuName(menuName);
|
||||
|
||||
menuShape.MenuName(menuName);
|
||||
NavigationHelper.PopulateMenu(shapeHelper, menuShape, menuShape, menuItems);
|
||||
|
||||
return shapeHelper.Parts_MenuWidget(Menu: menuShape);
|
||||
|
@ -519,6 +519,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Navigation\Views\Parts.MenuWidget.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Shapes\Views\Breadcrumb.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
18
src/Orchard.Web/Core/Shapes/Views/Breadcrumb.cshtml
Normal file
18
src/Orchard.Web/Core/Shapes/Views/Breadcrumb.cshtml
Normal file
@ -0,0 +1,18 @@
|
||||
@{
|
||||
// Model is Model.Menu from the layout (Layout.Menu)
|
||||
var tag = Tag(Model, "ul");
|
||||
tag.AddCssClass("breadcrumb");
|
||||
|
||||
var items = (IList<dynamic>)Enumerable.Cast<dynamic>(Model.Items);
|
||||
|
||||
if(items.Any()) {
|
||||
items[0].Classes.Add("first");
|
||||
items[items.Count - 1].Classes.Add("last");
|
||||
}
|
||||
}
|
||||
<nav>
|
||||
@tag.StartElement
|
||||
@* see MenuItem shape template *@
|
||||
@DisplayChildren(Model)
|
||||
@tag.EndElement
|
||||
</nav>
|
@ -1,6 +1,13 @@
|
||||
@{
|
||||
// Model is Model.Menu from the layout (Layout.Menu)
|
||||
var tag = Tag(Model, "ul");
|
||||
|
||||
var items = (IList<dynamic>)Enumerable.Cast<dynamic>(Model.Items);
|
||||
|
||||
if (items.Any()) {
|
||||
items[0].Classes.Add("first");
|
||||
items[items.Count - 1].Classes.Add("last");
|
||||
}
|
||||
}
|
||||
<nav>
|
||||
@tag.StartElement
|
||||
|
@ -12,11 +12,14 @@ if (!HasText(Model.Text)) {
|
||||
Model.Classes.Add("current");
|
||||
}
|
||||
if(items.Any()) {
|
||||
Model.Classes.Add("parent");
|
||||
Model.Classes.Add("dropdown");
|
||||
}
|
||||
var tag = Tag(Model, "li");
|
||||
@tag.StartElement
|
||||
<a href="@Model.Href">@Model.Text</a>
|
||||
if(Model.Divider != null) {
|
||||
@Display(Model.Divider)
|
||||
}
|
||||
if (items.Any()) {
|
||||
<ul>
|
||||
@DisplayChildren(Model)
|
||||
|
@ -337,7 +337,45 @@ nav > ul > li > ul > li > ul > li:hover > a { }
|
||||
/* deeper levels */
|
||||
nav > ul > li > ul > li > ul ul { display:none; }
|
||||
|
||||
/* Breadcrumb */
|
||||
nav ul.breadcrumb
|
||||
{
|
||||
border:none;
|
||||
display: inline-block;
|
||||
margin: -9px;
|
||||
}
|
||||
|
||||
nav ul.breadcrumb li
|
||||
{
|
||||
border:none;
|
||||
background:none;
|
||||
display:block;
|
||||
margin:0 2px -1px 0;
|
||||
}
|
||||
|
||||
nav ul.breadcrumb li:after
|
||||
{
|
||||
content: "/"
|
||||
}
|
||||
|
||||
nav ul.breadcrumb li.last:after
|
||||
{
|
||||
content: ""
|
||||
}
|
||||
|
||||
nav ul.breadcrumb li a
|
||||
{
|
||||
padding:0 9px;
|
||||
display:block;
|
||||
color: #5F97AF;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
nav ul.breadcrumb li a:hover
|
||||
{
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#layout-header {}
|
||||
#branding
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user