From b81652cf4f75daa2fdf9a0909138a60ad642b750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 9 May 2018 16:03:12 +0300 Subject: [PATCH] Render user menu using menumanager --- .../Toolbar/Items/UserMenu/Default.cshtml | 16 +++++++++++++--- .../Items/UserMenu/UserMenuViewComponent.cs | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/Default.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/Default.cshtml index d42b45bd5b..c799ba25b8 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/Default.cshtml +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/Default.cshtml @@ -1,20 +1,30 @@ @using Localization.Resources.AbpUi @using Microsoft.AspNetCore.Mvc.Localization @using Volo.Abp.MultiTenancy +@using Volo.Abp.UI.Navigation @using Volo.Abp.Users @inject ICurrentUser CurrentUser @inject ICurrentTenant CurrentTenant @inject IHtmlLocalizer L +@model ApplicationMenu @if (CurrentUser.IsAuthenticated) { } else diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/UserMenuViewComponent.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/UserMenuViewComponent.cs index e80bf10153..17e6a90ff5 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/UserMenuViewComponent.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/UserMenuViewComponent.cs @@ -1,12 +1,22 @@ -using Microsoft.AspNetCore.Mvc; +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.MainNavbar.Toolbar.Items.UserMenu { public class UserMenuViewComponent : AbpViewComponent { - public IViewComponentResult Invoke() + private readonly IMenuManager _menuManager; + + public UserMenuViewComponent(IMenuManager menuManager) + { + _menuManager = menuManager; + } + + public async Task InvokeAsync() { - return View("~/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/Default.cshtml"); + var menu = await _menuManager.GetAsync(StandardMenus.User); + return View("~/Views/Shared/Components/Theme/MainNavbar/Toolbar/Items/UserMenu/Default.cshtml", menu); } } }