Update 07082021
This commit is contained in:
21
BlazorApp - Kopie (3)/Shared/Common/SampleBaseComponent.cs
Normal file
21
BlazorApp - Kopie (3)/Shared/Common/SampleBaseComponent.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace BlazorApp.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// A base component to perform common functionalities.
|
||||
/// </summary>
|
||||
public class SampleBaseComponent: ComponentBase
|
||||
{
|
||||
//[Inject]
|
||||
//protected SampleService SampleService { get; set; }
|
||||
|
||||
//protected override void OnAfterRender(bool firstRender)
|
||||
//{
|
||||
// base.OnAfterRender(firstRender);
|
||||
// SampleService.Spinner?.Hide();
|
||||
// SampleService.Spinner?.ShowModalSpinner(false);
|
||||
//}
|
||||
}
|
||||
}
|
||||
32
BlazorApp - Kopie (3)/Shared/Common/SyncfusionLocalizer.cs
Normal file
32
BlazorApp - Kopie (3)/Shared/Common/SyncfusionLocalizer.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Syncfusion.Blazor;
|
||||
|
||||
namespace BlazorApp.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// Extends ISyncfusionStringLocalizer for applying localization to Syncfusion components.
|
||||
/// </summary>
|
||||
public class SyncfusionLocalizer : ISyncfusionStringLocalizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Get locale value from the resource file.
|
||||
/// </summary>
|
||||
/// <param name="key">Locale key for getting the translated text.</param>
|
||||
public string GetText(string key)
|
||||
{
|
||||
return this.ResourceManager.GetString(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access the resource file and get the exact value from the locale key.
|
||||
/// </summary>
|
||||
public System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
return BlazorApp.Resources.SfResources.ResourceManager;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5
BlazorApp - Kopie (3)/Shared/Login.razor
Normal file
5
BlazorApp - Kopie (3)/Shared/Login.razor
Normal file
@@ -0,0 +1,5 @@
|
||||
<h3>Login</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
206
BlazorApp - Kopie (3)/Shared/MainLayout.razor
Normal file
206
BlazorApp - Kopie (3)/Shared/MainLayout.razor
Normal file
@@ -0,0 +1,206 @@
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Radzen.Blazor
|
||||
@inherits LayoutComponentBase
|
||||
@inject ThemeState ThemeState
|
||||
@inject ExampleService ExampleService
|
||||
@inject MenuService MenuService
|
||||
@inject NavigationManager UriHelper
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IHttpContextAccessor httpContextAccessor
|
||||
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
|
||||
|
||||
@if (Theme != "default.css")
|
||||
{
|
||||
<link href="_content/Radzen.Blazor/css/@(Theme)" rel="stylesheet" />
|
||||
}
|
||||
<RadzenDialog />
|
||||
<RadzenNotification />
|
||||
<RadzenTooltip />
|
||||
<RadzenContextMenu />
|
||||
|
||||
<RadzenHeader>
|
||||
<ChildContent>
|
||||
<div class="row justify-content-start align-items-center">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<RadzenSidebarToggle Click="@(args => { sidebarExpanded = !sidebarExpanded; bodyExpanded = !bodyExpanded; })">
|
||||
</RadzenSidebarToggle>
|
||||
<RadzenLabel Text="Berufwahl-Parcours-Manager">
|
||||
</RadzenLabel>
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center justify-content-end">
|
||||
@*<div class="d-none d-md-inline-flex align-items-center">
|
||||
<Social />
|
||||
</div>*@
|
||||
<label class="d-none d-sm-inline-block" style="margin-left: 1rem">Ansicht:</label>
|
||||
<RadzenDropDown style="margin:0 .5rem" TValue="string" TextProperty="Text" ValueProperty="Value" Data="@themes" Value="@ThemeState.CurrentTheme" Change="@ChangeTheme" />
|
||||
</div>
|
||||
</div>
|
||||
</ChildContent>
|
||||
</RadzenHeader>
|
||||
<div style="width:100%">
|
||||
<RadzenBody @ref="@body0" @bind-Expanded="@bodyExpanded">
|
||||
<ChildContent>
|
||||
<RadzenContentContainer Name="main">
|
||||
@Body
|
||||
</RadzenContentContainer>
|
||||
</ChildContent>
|
||||
</RadzenBody>
|
||||
</div>
|
||||
|
||||
<RadzenSidebar @ref="@sidebar0" @bind-Expanded="@sidebarExpanded">
|
||||
<ChildContent>
|
||||
@*<div style="padding: 1rem">
|
||||
<RadzenTextBox Placeholder="Find component ..." type="search" @oninput="@FilterPanelMenu" style="width: 100%" />
|
||||
</div>*@
|
||||
<RadzenPanelMenu>
|
||||
<AuthorizeView Roles="Firma">
|
||||
<Authorized>
|
||||
@foreach (var mentry in CompanyMenu)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="@mentry.Expanded" Text="@mentry.Name" Path="@mentry.Path" Icon="@mentry.Icon">
|
||||
@if (mentry.Children != null)
|
||||
{
|
||||
@foreach (var child in mentry.Children)
|
||||
{
|
||||
if (child.Children != null)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="@child.Expanded" Text="@child.Name" Icon="@child.Icon">
|
||||
@foreach (var subchild in child.Children)
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@subchild.Name" Path="@subchild.Path" />}
|
||||
</RadzenPanelMenuItem> }
|
||||
else
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@child.Name" Path="@child.Path" Icon="@child.Icon" />}
|
||||
}}
|
||||
</RadzenPanelMenuItem>}
|
||||
|
||||
<RadzenPanelMenuItem Text="Abmelden" Path="/identity/account/logout" Icon=""></RadzenPanelMenuItem>
|
||||
</Authorized>
|
||||
<NotAuthorized></NotAuthorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView Roles="Administrators">
|
||||
<Authorized>
|
||||
|
||||
@foreach (var mentry in AdminMenu)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="@mentry.Expanded" Text="@mentry.Name" Path="@mentry.Path" Icon="@mentry.Icon">
|
||||
@if (mentry.Children != null)
|
||||
{
|
||||
@foreach (var child in mentry.Children)
|
||||
{
|
||||
if (child.Children != null)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="@child.Expanded" Text="@child.Name" Icon="@child.Icon">
|
||||
@foreach (var subchild in child.Children)
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@subchild.Name" Path="@subchild.Path" />}
|
||||
</RadzenPanelMenuItem> }
|
||||
else
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@child.Name" Path="@child.Path" Icon="@child.Icon" />}
|
||||
}}
|
||||
</RadzenPanelMenuItem>}
|
||||
|
||||
<RadzenPanelMenuItem Text="Abmelden" Path="/identity/account/logout" Icon=""></RadzenPanelMenuItem>
|
||||
</Authorized>
|
||||
|
||||
<NotAuthorized>
|
||||
<RadzenPanelMenuItem Text="Anmelden" Path="/identity/account/login" Icon=""></RadzenPanelMenuItem>
|
||||
<RadzenPanelMenuItem Text="Registrierung Firma" Path="/identity/account/registercompany" Icon=""></RadzenPanelMenuItem>
|
||||
<RadzenPanelMenuItem Text="Registrierung Lehrer" Path="/identity/account/registerteacher" Icon=""></RadzenPanelMenuItem>
|
||||
<RadzenPanelMenuItem Text="ScriptGenerator" Path="/Admin/ScriptGenerator" Icon=""></RadzenPanelMenuItem>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</RadzenPanelMenu>
|
||||
@*<RadzenPanelMenu>
|
||||
@foreach (var category in examples)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="@category.Expanded" Text="@category.Name" Path="@category.Path" Icon="@category.Icon">
|
||||
@if (category.Children != null)
|
||||
{
|
||||
@foreach (var example in category.Children)
|
||||
{
|
||||
if (example.Children != null)
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@example.Name" @bind-Expanded="@example.Expanded" Icon="@example.Icon">
|
||||
@foreach (var child in example.Children)
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@child.Name" Path="@child.Path" />}
|
||||
</RadzenPanelMenuItem> }
|
||||
else
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@example.Name" Path="@example.Path" Icon="@example.Icon" />}
|
||||
}}
|
||||
</RadzenPanelMenuItem>}
|
||||
</RadzenPanelMenu>*@
|
||||
</ChildContent>
|
||||
</RadzenSidebar>
|
||||
<RadzenFooter>
|
||||
<ChildContent>
|
||||
<RadzenLabel Text="Radzen Blazor Components, Copyright © 2020">
|
||||
</RadzenLabel>
|
||||
<RadzenLink Text="[source]" Path="https://github.com/radzenhq/radzen-blazor" Target="_blank" Style="margin-left:5px;vertical-align:bottom;" />
|
||||
</ChildContent>
|
||||
</RadzenFooter>
|
||||
@code { RadzenSidebar sidebar0;
|
||||
RadzenBody body0;
|
||||
bool sidebarExpanded = true;
|
||||
bool bodyExpanded = false;
|
||||
|
||||
dynamic themes = new[]
|
||||
{
|
||||
new { Text = "Default", Value = "default"},
|
||||
new { Text = "Dark", Value="dark" },
|
||||
new { Text = "Software", Value = "software"},
|
||||
new { Text = "Humanistic", Value = "humanistic" },
|
||||
new { Text = "Fluent", Value = "fluent" }
|
||||
|
||||
};
|
||||
|
||||
//public List<BlazorApp.Models.MenuItem> AdminMenu = new List<Models.MenuItem>();
|
||||
IEnumerable<BlazorApp.Models.MenuItem> AdminMenu;
|
||||
IEnumerable<BlazorApp.Models.MenuItem> CompanyMenu;
|
||||
|
||||
string Theme
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{ThemeState.CurrentTheme}.css";
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
|
||||
if (httpContextAccessor != null && httpContextAccessor.HttpContext != null &&
|
||||
httpContextAccessor.HttpContext.Request != null && httpContextAccessor.HttpContext.Request.Headers.ContainsKey("User-Agent"))
|
||||
{
|
||||
var userAgent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(userAgent))
|
||||
{
|
||||
if (userAgent.Contains("iPhone") || userAgent.Contains("Android") || userAgent.Contains("Googlebot"))
|
||||
{
|
||||
sidebarExpanded = false;
|
||||
bodyExpanded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AdminMenu = MenuService.MenuAdmin;
|
||||
CompanyMenu = MenuService.MenuComapny;
|
||||
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
|
||||
}
|
||||
public Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ChangeTheme(object value)
|
||||
{
|
||||
ThemeState.CurrentTheme = value.ToString();
|
||||
UriHelper.NavigateTo(UriHelper.ToAbsoluteUri(UriHelper.Uri).ToString());
|
||||
} }
|
||||
183
BlazorApp - Kopie (3)/Shared/NavMenu.razor
Normal file
183
BlazorApp - Kopie (3)/Shared/NavMenu.razor
Normal file
@@ -0,0 +1,183 @@
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Radzen.Blazor
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using Microsoft.AspNetCore.Identity;
|
||||
|
||||
@using Syncfusion.Blazor.Navigations
|
||||
@using BWPMModels
|
||||
@using Newtonsoft.Json
|
||||
@inject UserManager<IdentityUser> _UserManager
|
||||
@inherits LayoutComponentBase
|
||||
@inject ExampleService ExampleService
|
||||
@inject ThemeState ThemeState
|
||||
@inject NavigationManager UriHelper
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IHttpContextAccessor httpContextAccessor
|
||||
|
||||
@if (Theme != "default.css")
|
||||
{
|
||||
<link href="_content/Radzen.Blazor/css/@(Theme)" rel="stylesheet" />
|
||||
}
|
||||
<RadzenDialog />
|
||||
<RadzenNotification />
|
||||
<RadzenTooltip />
|
||||
<RadzenContextMenu />
|
||||
|
||||
<RadzenHeader>
|
||||
<ChildContent>
|
||||
<div class="row justify-content-start align-items-center">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<RadzenSidebarToggle Click="@(args => { sidebarExpanded = !sidebarExpanded; bodyExpanded = !bodyExpanded; })">
|
||||
</RadzenSidebarToggle>
|
||||
<RadzenLabel Text="Radzen Blazor Components">
|
||||
</RadzenLabel>
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center justify-content-end">
|
||||
@*<div class="d-none d-md-inline-flex align-items-center">
|
||||
<Social />
|
||||
</div>*@
|
||||
<label class="d-none d-sm-inline-block" style="margin-left: 1rem">Theme:</label>
|
||||
<RadzenDropDown style="margin:0 .5rem" TValue="string" TextProperty="Text" ValueProperty="Value" Data="@themes" Value="@ThemeState.CurrentTheme" Change="@ChangeTheme" />
|
||||
</div>
|
||||
</div>
|
||||
</ChildContent>
|
||||
</RadzenHeader>
|
||||
<div style="width:100%">
|
||||
<RadzenBody @ref="@body0" @bind-Expanded="@bodyExpanded">
|
||||
<ChildContent>
|
||||
<RadzenContentContainer Name="main">
|
||||
@Body
|
||||
</RadzenContentContainer>
|
||||
</ChildContent>
|
||||
</RadzenBody>
|
||||
</div>
|
||||
|
||||
<RadzenSidebar @ref="@sidebar0" @bind-Expanded="@sidebarExpanded">
|
||||
<ChildContent>
|
||||
@*<div style="padding: 1rem">
|
||||
<RadzenTextBox Placeholder="Find component ..." type="search" @oninput="@FilterPanelMenu" style="width: 100%" />
|
||||
</div>*@
|
||||
<RadzenPanelMenu>
|
||||
<AuthorizeView Roles="Administrators">
|
||||
<Authorized>
|
||||
@foreach (var Menuentry in AdminMenu)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="Menuentry.Expanded" Text="Menuentry.Name" Path="MenuEntry.Path" Icon="MenuEntry.Icon">
|
||||
</RadzenPanelMenuItem>}
|
||||
<RadzenPanelMenuItem Text="Abmelden" Path="/identity/account/logout" Icon=""></RadzenPanelMenuItem>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<RadzenPanelMenuItem Text="Anmelden" Path="/identity/account/login" Icon=""></RadzenPanelMenuItem>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</RadzenPanelMenu>
|
||||
@*<RadzenPanelMenu>
|
||||
@foreach (var category in examples)
|
||||
{
|
||||
<RadzenPanelMenuItem @bind-Expanded="@category.Expanded" Text="@category.Name" Path="@category.Path" Icon="@category.Icon">
|
||||
@if (category.Children != null)
|
||||
{
|
||||
@foreach (var example in category.Children)
|
||||
{
|
||||
if (example.Children != null)
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@example.Name" @bind-Expanded="@example.Expanded" Icon="@example.Icon">
|
||||
@foreach (var child in example.Children)
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@child.Name" Path="@child.Path" />}
|
||||
</RadzenPanelMenuItem> }
|
||||
else
|
||||
{
|
||||
<RadzenPanelMenuItem Text="@example.Name" Path="@example.Path" Icon="@example.Icon" />}
|
||||
}}
|
||||
</RadzenPanelMenuItem>}
|
||||
</RadzenPanelMenu>*@
|
||||
</ChildContent>
|
||||
</RadzenSidebar>
|
||||
<RadzenFooter>
|
||||
<ChildContent>
|
||||
<RadzenLabel Text="Radzen Blazor Components, Copyright © 2020">
|
||||
</RadzenLabel>
|
||||
<RadzenLink Text="[source]" Path="https://github.com/radzenhq/radzen-blazor" Target="_blank" Style="margin-left:5px;vertical-align:bottom;" />
|
||||
</ChildContent>
|
||||
</RadzenFooter>
|
||||
@code {
|
||||
|
||||
|
||||
RadzenSidebar sidebar0;
|
||||
RadzenBody body0;
|
||||
bool sidebarExpanded = true;
|
||||
bool bodyExpanded = false;
|
||||
|
||||
dynamic themes = new[]
|
||||
{
|
||||
new { Text = "Default", Value = "default"},
|
||||
new { Text = "Dark", Value="dark" },
|
||||
new { Text = "Software", Value = "software"},
|
||||
new { Text = "Humanistic", Value = "humanistic" }
|
||||
};
|
||||
|
||||
IEnumerable<BlazorApp.Models.MenuItem> AdminMenu;
|
||||
|
||||
string Theme
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{ThemeState.CurrentTheme}.css";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
|
||||
|
||||
if (httpContextAccessor != null && httpContextAccessor.HttpContext != null &&
|
||||
httpContextAccessor.HttpContext.Request != null && httpContextAccessor.HttpContext.Request.Headers.ContainsKey("User-Agent"))
|
||||
{
|
||||
var userAgent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(userAgent))
|
||||
{
|
||||
if (userAgent.Contains("iPhone") || userAgent.Contains("Android") || userAgent.Contains("Googlebot"))
|
||||
{
|
||||
sidebarExpanded = false;
|
||||
bodyExpanded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (!firstRender)
|
||||
{
|
||||
var example = ExampleService.FindCurrent(UriHelper.ToAbsoluteUri(UriHelper.Uri));
|
||||
|
||||
//await JSRuntime.InvokeVoidAsync("setTitle", ExampleService.TitleFor(example));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ChangeTheme(object value)
|
||||
{
|
||||
ThemeState.CurrentTheme = value.ToString();
|
||||
UriHelper.NavigateTo(UriHelper.ToAbsoluteUri(UriHelper.Uri).ToString());
|
||||
}
|
||||
|
||||
public class CustomMenuItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Text { get; set; }
|
||||
public string ParentId { get; set; }
|
||||
public string Url { get; set; }
|
||||
} }
|
||||
|
||||
|
||||
|
||||
|
||||
16
BlazorApp - Kopie (3)/Shared/SurveyPrompt.razor
Normal file
16
BlazorApp - Kopie (3)/Shared/SurveyPrompt.razor
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="alert alert-secondary mt-4" role="alert">
|
||||
<span class="oi oi-pencil mr-2" aria-hidden="true"></span>
|
||||
<strong>@Title</strong>
|
||||
|
||||
<span class="text-nowrap">
|
||||
Please take our
|
||||
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2112271">brief survey</a>
|
||||
</span>
|
||||
and tell us what you think.
|
||||
</div>
|
||||
|
||||
@code {
|
||||
// Demonstrates how a parent component can supply parameters
|
||||
[Parameter]
|
||||
public string Title { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user