Separate tools and brand and reorginize the layout components

pull/279/head
Halil İbrahim Kalkan 7 years ago
parent c6144db737
commit 8fcc06eab9

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar.Brand
{
public class MainNavbarBrandViewComponent : AbpViewComponent
{
public IViewComponentResult Invoke()
{
return View("~/Views/Shared/Components/Theme/MainNavbar/Brand/Default.cshtml");
}
}
}

@ -1,31 +1,21 @@
@using Localization.Resources.AbpUi @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar.Brand
@using Microsoft.AspNetCore.Mvc.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar.Menu
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbarMenu @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar.Tools
@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"> <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> @(await Component.InvokeAsync<MainNavbarBrandViewComponent>())
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-navbar-collapse" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#main-navbar-collapse" aria-controls="main-navbar-collapse"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="main-navbar-collapse"> <div class="collapse navbar-collapse" id="main-navbar-collapse">
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
@(await Component.InvokeAsync<MainNavbarMenuViewComponent>()) @(await Component.InvokeAsync<MainNavbarMenuViewComponent>())
@* TODO: Menu *@
</ul> </ul>
<span id="main-navbar-tools"> <span id="main-navbar-tools">
@if (CurrentUser.IsAuthenticated) @(await Component.InvokeAsync<MainNavbarToolsViewComponent>())
{
<span style="color: #fff">@CurrentUser.UserName</span> <text>(<a href="/Account/Logout">@L["Logout"]</a>)</text>
}
else
{
<a href="/Account/Login">Login</a>
}
</span> </span>
</div> </div>
</nav> </nav>

@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.UI.Navigation; using Volo.Abp.UI.Navigation;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbarMenu namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar.Menu
{ {
public class MainNavbarMenuViewComponent : AbpViewComponent public class MainNavbarMenuViewComponent : AbpViewComponent
{ {
@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.M
public async Task<IViewComponentResult> InvokeAsync() public async Task<IViewComponentResult> InvokeAsync()
{ {
var menu = await _menuManager.GetAsync(StandardMenus.Main); var menu = await _menuManager.GetAsync(StandardMenus.Main);
return View("~/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml", menu); return View("~/Views/Shared/Components/Theme/MainNavbar/Menu/Default.cshtml", menu);
} }
} }
} }

@ -0,0 +1,15 @@
@using Localization.Resources.AbpUi
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.MultiTenancy
@using Volo.Abp.Users
@inject ICurrentUser CurrentUser
@inject ICurrentTenant CurrentTenant
@inject IHtmlLocalizer<AbpUiResource> L
@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>
}

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar.Tools
{
public class MainNavbarToolsViewComponent : AbpViewComponent
{
public IViewComponentResult Invoke()
{
return View("~/Views/Shared/Components/Theme/MainNavbar/Tools/Default.cshtml");
}
}
}

@ -20,6 +20,10 @@
<EmbeddedResource Include="wwwroot\**\*.*" /> <EmbeddedResource Include="wwwroot\**\*.*" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Views\Shared\Components\Theme\MainNavbar\Tools\Default.cshtml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" /> <ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save