Added Customization for AppName
Currently used as prefix for page titles
This commit is contained in:
parent
638820e7dc
commit
76183c17a2
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<Routes />
|
<Routes />
|
||||||
<script src="_framework/blazor.web.js"></script>
|
<script src="_framework/blazor.web.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
@inject UserManager<ApplicationUser> UserManager
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
@inject SignInManager<ApplicationUser> SignInManager
|
@inject SignInManager<ApplicationUser> SignInManager
|
||||||
@inject IdentityRedirectManager RedirectManager
|
@inject IdentityRedirectManager RedirectManager
|
||||||
|
@inject IStringLocalizer<Admin> Localizer
|
||||||
|
|
||||||
|
<PageTitle>@(TitlePrefix + Localizer["Title"])</PageTitle>
|
||||||
|
|
||||||
<StatusMessage Message="@Message" />
|
<StatusMessage Message="@Message" />
|
||||||
|
|
||||||
|
@ -34,6 +37,9 @@
|
||||||
</EditForm>
|
</EditForm>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[CascadingParameter(Name = "TitlePrefix")]
|
||||||
|
private string TitlePrefix { get; set; } = default!;
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
private ApplicationUser User { get; set; } = default!;
|
private ApplicationUser User { get; set; } = default!;
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
@inject IStringLocalizer<ArticleEditor> Localizer
|
@inject IStringLocalizer<ArticleEditor> Localizer
|
||||||
|
|
||||||
@if (Article is not null) {
|
@if (Article is not null) {
|
||||||
<PageTitle>@Localizer["PageTitle_Edit"] - @Article.Title</PageTitle>
|
<PageTitle>@(TitlePrefix + Localizer["PageTitle_Edit"]) | @Article.Title</PageTitle>
|
||||||
} else {
|
} else {
|
||||||
<PageTitle>@Localizer["PageTitle_New"]</PageTitle>
|
<PageTitle>@(TitlePrefix + Localizer["PageTitle_New"])</PageTitle>
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1 class="text-3xl lg:text-5xl font-light mb-6">@Localizer["EditorTitle"]</h1>
|
<h1 class="text-3xl lg:text-5xl font-light mb-6">@Localizer["EditorTitle"]</h1>
|
||||||
|
@ -61,6 +61,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[CascadingParameter(Name = "TitlePrefix")]
|
||||||
|
private string TitlePrefix { get; set; } = default!;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Guid? Id { get; set; }
|
public Guid? Id { get; set; }
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
|
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
|
||||||
@inject IStringLocalizer<ArticleView> Localizer
|
@inject IStringLocalizer<ArticleView> Localizer
|
||||||
|
|
||||||
<PageTitle>Wave - @Article.Title</PageTitle>
|
<PageTitle>@(TitlePrefix + Article.Title)</PageTitle>
|
||||||
|
|
||||||
<h1 class="text-3xl lg:text-5xl font-light">@Article.Title</h1>
|
<h1 class="text-3xl lg:text-5xl font-light">@Article.Title</h1>
|
||||||
<p class="mb-3">
|
<p class="mb-3">
|
||||||
|
@ -66,6 +66,9 @@
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[CascadingParameter(Name = "TitlePrefix")]
|
||||||
|
private string TitlePrefix { get; set; } = default!;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
|
@inject IDbContextFactory<ApplicationDbContext> ContextFactory;
|
||||||
@inject IStringLocalizer<Home> Localizer
|
@inject IStringLocalizer<Home> Localizer
|
||||||
|
|
||||||
<PageTitle>@Localizer["Title"]</PageTitle>
|
<PageTitle>@(TitlePrefix + Localizer["Title"])</PageTitle>
|
||||||
|
|
||||||
<h1 class="text-3xl lg:text-5xl font-light mb-3">@Localizer["Title"]</h1>
|
<h1 class="text-3xl lg:text-5xl font-light mb-3">@Localizer["Title"]</h1>
|
||||||
|
|
||||||
|
@ -54,6 +54,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[CascadingParameter(Name = "TitlePrefix")]
|
||||||
|
private string TitlePrefix { get; set; } = default!;
|
||||||
|
|
||||||
private List<Article> Articles { get; } = [];
|
private List<Article> Articles { get; } = [];
|
||||||
private bool HasMore { get; set; }
|
private bool HasMore { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
@using Microsoft.AspNetCore.Identity
|
@using Microsoft.AspNetCore.Identity
|
||||||
@using Wave.Data
|
@using Wave.Data
|
||||||
|
|
||||||
@rendermode @(new InteractiveServerRenderMode(false))
|
@rendermode InteractiveServer
|
||||||
@attribute [Authorize(Policy = "RoleAssignPermissions")]
|
@attribute [Authorize(Policy = "RoleAssignPermissions")]
|
||||||
@attribute [StreamRendering]
|
@attribute [StreamRendering]
|
||||||
@inject UserManager<ApplicationUser> UserManager
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
@inject IStringLocalizer<ManageUsers> Localizer
|
@inject IStringLocalizer<ManageUsers> Localizer
|
||||||
|
|
||||||
<PageTitle>@Localizer["Title"]</PageTitle>
|
<PageTitle>@(TitlePrefix + Localizer["Title"])</PageTitle>
|
||||||
|
|
||||||
<h1 class="text-3xl lg:text-5xl font-light mb-6">@Localizer["Title"]</h1>
|
<h1 class="text-3xl lg:text-5xl font-light mb-6">@Localizer["Title"]</h1>
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@
|
||||||
<ToastComponent @ref="Toast" />
|
<ToastComponent @ref="Toast" />
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
[CascadingParameter(Name = "TitlePrefix")]
|
||||||
|
private string TitlePrefix { get; set; } = default!;
|
||||||
|
|
||||||
public ToastComponent Toast { get; set; } = null!;
|
public ToastComponent Toast { get; set; } = null!;
|
||||||
|
|
||||||
private IList<ApplicationUser> Authors { get; set; } = new List<ApplicationUser>();
|
private IList<ApplicationUser> Authors { get; set; } = new List<ApplicationUser>();
|
||||||
|
@ -49,10 +52,11 @@
|
||||||
private IList<ApplicationUser> Admins { get; set; } = new List<ApplicationUser>();
|
private IList<ApplicationUser> Admins { get; set; } = new List<ApplicationUser>();
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
private Task<AuthenticationState>? AuthenticationState { get; set; }
|
private Task<AuthenticationState> AuthenticationState { get; set; } = default!;
|
||||||
private ApplicationUser? User { get; set; }
|
private ApplicationUser? User { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync() {
|
protected override async Task OnAfterRenderAsync(bool firstRender) {
|
||||||
|
if (!firstRender) return;
|
||||||
var state = await AuthenticationState;
|
var state = await AuthenticationState;
|
||||||
User = await UserManager.GetUserAsync(state.User);
|
User = await UserManager.GetUserAsync(state.User);
|
||||||
|
|
||||||
|
|
5
Wave/Data/Customization.cs
Normal file
5
Wave/Data/Customization.cs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
namespace Wave.Data;
|
||||||
|
|
||||||
|
public class Customization {
|
||||||
|
public string AppName { get; set; } = "Wave";
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
using Microsoft.AspNetCore.Components.Server;
|
using Microsoft.AspNetCore.Components.Server;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Wave.Components;
|
using Wave.Components;
|
||||||
using Wave.Components.Account;
|
using Wave.Components.Account;
|
||||||
using Wave.Data;
|
using Wave.Data;
|
||||||
|
@ -62,6 +63,10 @@
|
||||||
});
|
});
|
||||||
builder.Services.AddScoped<ImageService>();
|
builder.Services.AddScoped<ImageService>();
|
||||||
|
|
||||||
|
builder.Services.Configure<Customization>(builder.Configuration.GetSection(nameof(Customization)));
|
||||||
|
builder.Services.AddCascadingValue("TitlePrefix",
|
||||||
|
sf => (sf.GetService<IOptions<Customization>>()?.Value.AppName ?? "Wave") + " - ");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue