Files
OurUmbraco/OurUmbraco.Site/Views/MacroPartials/Documenation/Navigation.cshtml
T
2015-08-21 15:53:22 +02:00

55 lines
2.2 KiB
Plaintext

@using OurUmbraco.Documentation.Busineslogic.GithubSourcePull
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var zipper = new ZipDownloader();
dynamic sitemap = zipper.DocumentationSiteMap();
var root = "/documentation";
var currentUrl = HttpContext.Current.Request.Url.PathAndQuery;
}
@functions{
public static string IsActive(string path, string classname = "active")
{
if (HttpContext.Current.Request.Url.PathAndQuery.ToLower().StartsWith(path.ToLower()))
return classname;
return string.Empty;
}
}
<nav>
<ul class="level-1">
@foreach (dynamic item in sitemap.directories)
{
if (item.name != "images" && item.name != "Development-Guidelines" && item.name != "Extending-Umbraco" && item.name != "Using-Umbraco" && item.name != "Installation" && item.name != "Products" && item.name != "Cheatsheets")
{
<li class=" @IsActive(root+item.path, "active open")">
<a href="@(root + item.path)/"><h3>@item.name</h3></a>
@if(item.hasChildren != null && (bool)item.hasChildren)
{
<ul class="level-2 @IsActive(root+item.path, "open")">
@foreach(dynamic itemChild in item.directories){
<li class=" @IsActive(root+itemChild.path, "active open")">
<a href="@(root + itemChild.path)/"><h4>@itemChild.name</h4></a>
@if(itemChild.hasChildren != null && (bool)itemChild.hasChildren) {
<ul class="level-3 @IsActive(root+item.path, "open")">
@foreach (dynamic itemGrandChild in itemChild.directories)
{
<li class=" @IsActive(root+itemGrandChild.path, "active")"><a href="@(root + itemGrandChild.path)/"><h5>@itemGrandChild.name</h5></a></li>
}
</ul>
}
</li>
}
</ul>
}
</li>
}
}
</ul>
</nav>