Browse Source

Added ManageYourAccount navigation to Blazor LoginDisplay

pull/5681/head
Ahmet 6 years ago
parent
commit
48d73aa607
  1. 3
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor
  2. 40
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs

3
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor

@ -17,6 +17,9 @@
<DropdownItem Clicked="@(() => NavigateTo(menuItem.Url))">@menuItem.DisplayName</DropdownItem>
}
}
<a class="dropdown-item" href="@ServerAccountUrl">
@UiLocalizer["ManageYourAccount"]
</a>
<DropdownDivider />
<DropdownItem Clicked="BeginSignOut">Logout</DropdownItem>
</DropdownMenu>

40
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor.cs

@ -1,18 +1,50 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Volo.Abp.Http.Client;
using Volo.Abp.UI.Navigation;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic
{
public partial class LoginDisplay
public partial class LoginDisplay : IDisposable
{
[Inject] protected IMenuManager MenuManager { get; set; }
[Inject]
protected IMenuManager MenuManager { get; set; }
[Inject]
protected IStringLocalizer<AbpUiResource> UiLocalizer { get; set; }
[Inject]
protected IOptions<AbpRemoteServiceOptions> RemoteServiceOptions { get; set; }
protected ApplicationMenu Menu { get; set; }
protected string ServerUrl { get; set; }
protected string ServerAccountUrl { get; set; }
protected override async Task OnInitializedAsync()
{
Menu = await MenuManager.GetAsync(StandardMenus.User);
ServerUrl = RemoteServiceOptions.Value.RemoteServices.Default?.BaseUrl?.TrimEnd('/');
ServerAccountUrl = ServerUrl + "/Account/Manage?returnUrl=" + Navigation.Uri;
Navigation.LocationChanged += OnLocationChanged;
}
protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e)
{
ServerAccountUrl = ServerUrl + "/Account/Manage?returnUrl=" + Navigation.Uri;
StateHasChanged();
}
public void Dispose()
{
Navigation.LocationChanged -= OnLocationChanged;
}
}
}
Loading…
Cancel
Save