From 5fe07987759a04f72677e4101c47e06e59e8d71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 2 May 2018 13:23:51 +0300 Subject: [PATCH] Separated menu and navbar components --- .../Shared/Components/AbpMenu/Default.cshtml | 52 ------------------- .../Theme/MainNavbar/Default.cshtml | 31 +++++++++++ .../MainNavbar/MainNavbarViewComponent.cs | 12 +++++ .../MainNavbarMenu/AbpMenuViewComponent.cs | 22 ++++++++ .../Theme/MainNavbarMenu/Default.cshtml | 24 +++++++++ .../Views/Shared/_AppLayout.cshtml | 4 +- ...o.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj | 8 --- .../AbpMenu/AbpMenuViewComponent.cs | 22 -------- 8 files changed, 91 insertions(+), 84 deletions(-) delete mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/AbpMenu/Default.cshtml create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Default.cshtml create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/MainNavbarViewComponent.cs create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/AbpMenuViewComponent.cs create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml delete mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI/Views/Shared/Components/AbpMenu/AbpMenuViewComponent.cs diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/AbpMenu/Default.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/AbpMenu/Default.cshtml deleted file mode 100644 index 472bf803a4..0000000000 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/AbpMenu/Default.cshtml +++ /dev/null @@ -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 L - diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Default.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Default.cshtml new file mode 100644 index 0000000000..3f59023e01 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Default.cshtml @@ -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 L + diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/MainNavbarViewComponent.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/MainNavbarViewComponent.cs new file mode 100644 index 0000000000..8fabb74daa --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/MainNavbarViewComponent.cs @@ -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"); + } + } +} diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/AbpMenuViewComponent.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/AbpMenuViewComponent.cs new file mode 100644 index 0000000000..5e96e6e4d9 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/AbpMenuViewComponent.cs @@ -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 InvokeAsync() + { + var menu = await _menuManager.GetAsync(StandardMenus.Main); + return View("~/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml", menu); + } + } +} diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml new file mode 100644 index 0000000000..1dd58ce3b9 --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbarMenu/Default.cshtml @@ -0,0 +1,24 @@ +@using Volo.Abp.UI.Navigation +@model ApplicationMenu +@foreach (var menuItem in Model.Items) +{ + if (menuItem.IsLeaf) + { + + } + else + { + + } +} diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/_AppLayout.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/_AppLayout.cshtml index f8c19c0f34..899e7a90b9 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/_AppLayout.cshtml +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/_AppLayout.cshtml @@ -1,4 +1,5 @@ @using Volo.Abp.AspNetCore.Mvc.AntiForgery +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Views.Shared.Components.Theme.MainNavbar @using Volo.Abp.UI.Navigation @inject IAbpAntiForgeryManager AbpAntiForgeryManager @{ @@ -23,8 +24,7 @@ - - + @(await Component.InvokeAsync())
@RenderBody() diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj index 00820a092d..6994f88381 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj @@ -20,14 +20,6 @@ - - - - - - - - diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI/Views/Shared/Components/AbpMenu/AbpMenuViewComponent.cs b/src/Volo.Abp.AspNetCore.Mvc.UI/Views/Shared/Components/AbpMenu/AbpMenuViewComponent.cs deleted file mode 100644 index 218a18df9a..0000000000 --- a/src/Volo.Abp.AspNetCore.Mvc.UI/Views/Shared/Components/AbpMenu/AbpMenuViewComponent.cs +++ /dev/null @@ -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 InvokeAsync(string menuName = StandardMenus.Main, string viewName = "Default") - { - var menu = await _menuManager.GetAsync(menuName); - return View(viewName, menu); - } - } -}