Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (22 sloc) 1.11 KB
@* Copyright © 2015 Dmitry Sikorsky. All rights reserved. *@
@* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. *@
@model Platformus.Menus.Frontend.ViewModels.Shared.MenuItemViewModel
@using Microsoft.AspNetCore.Routing
@{
string url = "/" + System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName + "/" + this.Context.GetRouteValue("url") as string;
bool isActive = string.Equals(this.Model.Url, url, StringComparison.OrdinalIgnoreCase);
string levelSuffix = this.Model.Level == 1 ? null : "-level-" + this.Model.Level;
}
<div class="menu__item@(levelSuffix) @(isActive ? "menu__item--active" + levelSuffix : null)">
<a class="menu__item-name@(levelSuffix) @(isActive ? "menu__item-name--active" + levelSuffix : null)" href="@Model.Url">@Model.Name</a>
@if (this.Model.MenuItems.Count() != 0)
{
<div class="menu__items-level-@(this.Model.Level + 1)">
@foreach (var menuItem in this.Model.MenuItems)
{
menuItem.Level = this.Model.Level + 1;
@Html.Partial("_MenuItem", menuItem)
}
</div>
}
</div>