支持子菜单active状态
This commit is contained in:
parent
8659c94cd4
commit
578f26aaba
|
@ -10,9 +10,19 @@ namespace Bootstrap.Admin.Models
|
||||||
public NavigatorBarModel(string url)
|
public NavigatorBarModel(string url)
|
||||||
{
|
{
|
||||||
Navigations = MenuHelper.RetrieveNavigationsByUserName(UserName);
|
Navigations = MenuHelper.RetrieveNavigationsByUserName(UserName);
|
||||||
Navigations.ToList().ForEach(m => m.Active = m.Url.Equals(url, StringComparison.OrdinalIgnoreCase) ? "active" : "");
|
ActiveMenu(null, Navigations.ToList(), url);
|
||||||
HomeUrl = "~/Admin/Index";
|
HomeUrl = "~/Admin/Index";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ActiveMenu(Menu parent, List<Menu> menus, string url)
|
||||||
|
{
|
||||||
|
menus.ForEach(m =>
|
||||||
|
{
|
||||||
|
m.Active = m.Url.Equals(url, StringComparison.OrdinalIgnoreCase) ? "active" : "";
|
||||||
|
ActiveMenu(m, m.Menus.ToList(), url);
|
||||||
|
if (parent != null && m.Active != "") parent.Active = m.Active;
|
||||||
|
});
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue