Add identity first iteration
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<RadzenComponents @rendermode="InteractiveServer" />
|
||||
@ -12,12 +14,30 @@
|
||||
</RadzenStack>
|
||||
</RadzenHeader>
|
||||
<RadzenSidebar @bind-Expanded="@sidebarExpanded">
|
||||
<RadzenPanelMenu>
|
||||
<RadzenPanelMenuItem Click="@(() => NavigationManager.NavigateTo("/"))" Text="Главная" Icon="home" />
|
||||
<RadzenPanelMenuItem Text="Тестирование" Icon="simulation">
|
||||
<RadzenPanelMenuItem Click="@(() => NavigationManager.NavigateTo("/test/export"))" Text="Экспорт" Icon="arrow_outward" />
|
||||
</RadzenPanelMenuItem>
|
||||
</RadzenPanelMenu>
|
||||
<RadzenStack Style="height: 100%" JustifyContent="JustifyContent.SpaceBetween">
|
||||
<RadzenPanelMenu>
|
||||
<RadzenPanelMenuItem Click="@(() => NavigationManager.NavigateTo("/"))" Text="Главная" Icon="home" />
|
||||
<RadzenPanelMenuItem Text="Тестирование" Icon="simulation">
|
||||
<RadzenPanelMenuItem Click="@(() => NavigationManager.NavigateTo("/test/export"))" Text="Экспорт" Icon="arrow_outward" />
|
||||
</RadzenPanelMenuItem>
|
||||
</RadzenPanelMenu>
|
||||
<RadzenPanelMenu>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<RadzenPanelMenuItem Text="@context.User.Identity?.Name" />
|
||||
<RadzenPanelMenuItem Path="javascript:document.forms['logout'].submit();" Text="Выйти" Icon="logout" />
|
||||
<form action="account/logout" method="post" name="logout">
|
||||
<AntiforgeryToken />
|
||||
<input type="hidden" name="ReturnUrl" value="@currentUrl" />
|
||||
</form>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<RadzenPanelMenuItem Click="@(() => NavigationManager.NavigateTo("/account/register"))" Text="Регистрация" Icon="person_add" />
|
||||
<RadzenPanelMenuItem Click="@(() => NavigationManager.NavigateTo("/account/login"))" Text="Вход" Icon="login" />
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</RadzenPanelMenu>
|
||||
</RadzenStack>
|
||||
</RadzenSidebar>
|
||||
<RadzenBody>
|
||||
@Body
|
||||
@ -32,4 +52,24 @@
|
||||
|
||||
@code {
|
||||
bool sidebarExpanded = true;
|
||||
string? currentUrl;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
currentUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
|
||||
|
||||
NavigationManager.LocationChanged += OnLocationChanged;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
NavigationManager.LocationChanged -= OnLocationChanged;
|
||||
}
|
||||
|
||||
private void OnLocationChanged(object? sender, LocationChangedEventArgs e)
|
||||
{
|
||||
currentUrl = NavigationManager.ToBaseRelativePath(e.Location);
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user