mirror of https://github.com/abpframework/abp.git
8 changed files with 91 additions and 84 deletions
@ -1,52 +0,0 @@ |
|||
@using Localization.Resources.AbpUi |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.Abp.MultiTenancy |
|||
@using Volo.Abp.UI.Navigation |
|||
@using Volo.Abp.Users |
|||
@model ApplicationMenu |
|||
@inject ICurrentUser CurrentUser |
|||
@inject ICurrentTenant CurrentTenant |
|||
@inject IHtmlLocalizer<AbpUiResource> L |
|||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> |
|||
<a class="navbar-brand" href="~/"><i>Project</i>Name</a> |
|||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-navbar-collapse" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> |
|||
<span class="navbar-toggler-icon"></span> |
|||
</button> |
|||
<div class="collapse navbar-collapse" id="main-navbar-collapse"> |
|||
<ul class="navbar-nav mr-auto"> |
|||
@foreach (var menuItem in Model.Items) |
|||
{ |
|||
if (menuItem.IsLeaf) |
|||
{ |
|||
<li class="nav-item @(menuItem.IsDisabled ? "disabled" : "")"> |
|||
<!-- active --> |
|||
<a class="nav-link" href="@(menuItem.Url ?? "#")">@menuItem.DisplayName</a> @*<span class="sr-only">(current)</span>*@ |
|||
</li> |
|||
} |
|||
else |
|||
{ |
|||
<li class="nav-item dropdown"> |
|||
<a class="nav-link dropdown-toggle" href="#" id="Menu_@(menuItem.Name)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">@menuItem.DisplayName</a> |
|||
<div class="dropdown-menu" aria-labelledby="Menu_@(menuItem.Name)"> |
|||
@foreach (var childMenuItem in menuItem.Items) |
|||
{ |
|||
<a class="dropdown-item" href="@(childMenuItem.Url ?? "#")">@childMenuItem.DisplayName</a> |
|||
} |
|||
</div> |
|||
</li> |
|||
} |
|||
} |
|||
</ul> |
|||
|
|||
<span id="main-navbar-tools"> |
|||
@if (CurrentUser.IsAuthenticated) |
|||
{ |
|||
<span style="color: #fff">@CurrentUser.UserName</span> <text>(<a href="/Account/Logout">@L["Logout"]</a>)</text> |
|||
} |
|||
else |
|||
{ |
|||
<a href="/Account/Login">Login</a> |
|||
} |
|||
</span> |
|||
</div> |
|||
</nav> |
|||
@ -0,0 +1,31 @@ |
|||
@using Localization.Resources.AbpUi |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbarMenu |
|||
@using Volo.Abp.MultiTenancy |
|||
@using Volo.Abp.Users |
|||
@inject ICurrentUser CurrentUser |
|||
@inject ICurrentTenant CurrentTenant |
|||
@inject IHtmlLocalizer<AbpUiResource> L |
|||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top" id="main-navbar"> |
|||
<a class="navbar-brand" href="~/"><i>Project</i>Name</a> |
|||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-navbar-collapse" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> |
|||
<span class="navbar-toggler-icon"></span> |
|||
</button> |
|||
<div class="collapse navbar-collapse" id="main-navbar-collapse"> |
|||
<ul class="navbar-nav mr-auto"> |
|||
@(await Component.InvokeAsync<MainNavbarMenuViewComponent>()) |
|||
@* TODO: Menu *@ |
|||
</ul> |
|||
|
|||
<span id="main-navbar-tools"> |
|||
@if (CurrentUser.IsAuthenticated) |
|||
{ |
|||
<span style="color: #fff">@CurrentUser.UserName</span> <text>(<a href="/Account/Logout">@L["Logout"]</a>)</text> |
|||
} |
|||
else |
|||
{ |
|||
<a href="/Account/Login">Login</a> |
|||
} |
|||
</span> |
|||
</div> |
|||
</nav> |
|||
@ -0,0 +1,12 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar |
|||
{ |
|||
public class MainNavbarViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("~/Views/Shared/Components/Theme/MainNavbar/Default.cshtml"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.UI.Navigation; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbarMenu |
|||
{ |
|||
public class MainNavbarMenuViewComponent : AbpViewComponent |
|||
{ |
|||
private readonly IMenuManager _menuManager; |
|||
|
|||
public MainNavbarMenuViewComponent(IMenuManager menuManager) |
|||
{ |
|||
_menuManager = menuManager; |
|||
} |
|||
|
|||
public async Task<IViewComponentResult> InvokeAsync() |
|||
{ |
|||
var menu = await _menuManager.GetAsync(StandardMenus.Main); |
|||
return View("~/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml", menu); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
@using Volo.Abp.UI.Navigation |
|||
@model ApplicationMenu |
|||
@foreach (var menuItem in Model.Items) |
|||
{ |
|||
if (menuItem.IsLeaf) |
|||
{ |
|||
<li class="nav-item @(menuItem.IsDisabled ? "disabled" : "")"> |
|||
<!-- active --> |
|||
<a class="nav-link" href="@(menuItem.Url ?? "#")">@menuItem.DisplayName</a> @*<span class="sr-only">(current)</span>*@ |
|||
</li> |
|||
} |
|||
else |
|||
{ |
|||
<li class="nav-item dropdown"> |
|||
<a class="nav-link dropdown-toggle" href="#" id="Menu_@(menuItem.Name)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">@menuItem.DisplayName</a> |
|||
<div class="dropdown-menu" aria-labelledby="Menu_@(menuItem.Name)"> |
|||
@foreach (var childMenuItem in menuItem.Items) |
|||
{ |
|||
<a class="dropdown-item" href="@(childMenuItem.Url ?? "#")">@childMenuItem.DisplayName</a> |
|||
} |
|||
</div> |
|||
</li> |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.UI.Navigation; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.Views.Shared.Components.AbpMenu |
|||
{ |
|||
public class AbpMenuViewComponent : AbpViewComponent |
|||
{ |
|||
private readonly IMenuManager _menuManager; |
|||
|
|||
public AbpMenuViewComponent(IMenuManager menuManager) |
|||
{ |
|||
_menuManager = menuManager; |
|||
} |
|||
|
|||
public async Task<IViewComponentResult> InvokeAsync(string menuName = StandardMenus.Main, string viewName = "Default") |
|||
{ |
|||
var menu = await _menuManager.GetAsync(menuName); |
|||
return View(viewName, menu); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue