Update vor Blazorise
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
</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 />
|
||||
<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" />
|
||||
@@ -48,188 +48,209 @@
|
||||
</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)
|
||||
<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="Lehrer">
|
||||
<Authorized>
|
||||
@foreach (var mentry in TeacherMenu)
|
||||
{
|
||||
<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>
|
||||
<RadzenPanelMenuItem Text="ShowConfig" Path="/ShowConfig" Icon=""></RadzenPanelMenuItem>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</RadzenPanelMenu>
|
||||
@*<RadzenPanelMenu>
|
||||
@foreach (var category in examples)
|
||||
<RadzenPanelMenuItem @bind-Expanded="@mentry.Expanded" Text="@mentry.Name" Path="@mentry.Path" Icon="@mentry.Icon">
|
||||
@if (mentry.Children != null)
|
||||
{
|
||||
<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="Copyright ©">
|
||||
</RadzenLabel>
|
||||
<RadzenLink Text="Stefan Hutter Unternehmensberatung" Path="https://www.shub.ch" Target="_blank" Style="margin-center:5px;vertical-align:bottom;" />
|
||||
</ChildContent>
|
||||
</RadzenFooter>
|
||||
@code { RadzenSidebar sidebar0;
|
||||
RadzenBody body0;
|
||||
bool sidebarExpanded = true;
|
||||
bool bodyExpanded = false;
|
||||
@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" />
|
||||
}
|
||||
}
|
||||
|
||||
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" }
|
||||
}
|
||||
</RadzenPanelMenuItem>
|
||||
}
|
||||
|
||||
<RadzenPanelMenuItem Text="Abmelden" Path="/identity/account/logout" Icon=""></RadzenPanelMenuItem>
|
||||
</Authorized>
|
||||
<NotAuthorized></NotAuthorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView Roles="Lehrer">
|
||||
<Authorized>
|
||||
@foreach (var mentry in TeacherMenu)
|
||||
{
|
||||
<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>
|
||||
<RadzenPanelMenuItem Text="ShowConfig" Path="/ShowConfig" 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="Copyright ©">
|
||||
</RadzenLabel>
|
||||
<RadzenLink Text="Stefan Hutter Unternehmensberatung" Path="https://www.shub.ch" Target="_blank" Style="margin-center: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;
|
||||
IEnumerable<BlazorApp.Models.MenuItem> TeacherMenu;
|
||||
//public List<BlazorApp.Models.MenuItem> AdminMenu = new List<Models.MenuItem>();
|
||||
IEnumerable<BlazorApp.Models.MenuItem> AdminMenu;
|
||||
IEnumerable<BlazorApp.Models.MenuItem> CompanyMenu;
|
||||
IEnumerable<BlazorApp.Models.MenuItem> TeacherMenu;
|
||||
|
||||
string Theme
|
||||
string Theme
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{ThemeState.CurrentTheme}.css";
|
||||
}
|
||||
return $"{ThemeState.CurrentTheme}.css";
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
|
||||
if (httpContextAccessor != null && httpContextAccessor.HttpContext != null &&
|
||||
httpContextAccessor.HttpContext.Request != null && httpContextAccessor.HttpContext.Request.Headers.ContainsKey("User-Agent"))
|
||||
{
|
||||
|
||||
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))
|
||||
{
|
||||
var userAgent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(userAgent))
|
||||
if (userAgent.Contains("iPhone") || userAgent.Contains("Android") || userAgent.Contains("Googlebot"))
|
||||
{
|
||||
if (userAgent.Contains("iPhone") || userAgent.Contains("Android") || userAgent.Contains("Googlebot"))
|
||||
{
|
||||
sidebarExpanded = false;
|
||||
bodyExpanded = true;
|
||||
}
|
||||
sidebarExpanded = false;
|
||||
bodyExpanded = true;
|
||||
}
|
||||
}
|
||||
|
||||
AdminMenu = MenuService.MenuAdmin;
|
||||
CompanyMenu = MenuService.MenuComapny;
|
||||
TeacherMenu = MenuService.MenuTeacher;
|
||||
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
|
||||
}
|
||||
public Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
AdminMenu = MenuService.MenuAdmin;
|
||||
CompanyMenu = MenuService.MenuComapny;
|
||||
TeacherMenu = MenuService.MenuTeacher;
|
||||
|
||||
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());
|
||||
} }
|
||||
void ChangeTheme(object value)
|
||||
{
|
||||
ThemeState.CurrentTheme = value.ToString();
|
||||
UriHelper.NavigateTo(UriHelper.ToAbsoluteUri(UriHelper.Uri).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user