Added Future Page
This commit is contained in:
parent
daedaeda4b
commit
428b462371
|
@ -21,6 +21,11 @@
|
|||
<li><NavLink href="review">@Localizer["Review_Label"]</NavLink></li>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView Policy="ArticleDeletePermissions">
|
||||
<Authorized>
|
||||
<li><NavLink href="future">@Localizer["Future_Label"]</NavLink></li>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
<AuthorizeView Policy="RoleAssignPermissions">
|
||||
<Authorized>
|
||||
<li><NavLink href="manage/users">@Localizer["ManageUsers_Label"]</NavLink></li>
|
||||
|
|
33
Wave/Components/Pages/Future.razor
Normal file
33
Wave/Components/Pages/Future.razor
Normal file
|
@ -0,0 +1,33 @@
|
|||
@page "/future"
|
||||
@using Wave.Data
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using Wave.Data.Migrations.postgres
|
||||
|
||||
@attribute [Authorize(Policy = "ArticleDeletePermissions")]
|
||||
@inject IDbContextFactory<ApplicationDbContext> ContextFactory
|
||||
@inject IStringLocalizer<Future> Localizer
|
||||
|
||||
<div class="flex gap-x-8 gap-y-4">
|
||||
@foreach (var article in Articles) {
|
||||
<ArticleTile Article="article" />
|
||||
}
|
||||
@if(Articles.Count < 1) {
|
||||
<p>@Localizer["NoArticles"]</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private List<Article> Articles { get; } = [];
|
||||
|
||||
protected override async Task OnInitializedAsync() {
|
||||
await using var context = await ContextFactory.CreateDbContextAsync();
|
||||
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
Articles.AddRange(await
|
||||
context.Set<Article>()
|
||||
.Include(a => a.Author)
|
||||
.Where(a => a.Status == ArticleStatus.Published && a.PublishDate > now)
|
||||
.OrderByDescending(a => a.PublishDate)
|
||||
.ToListAsync());
|
||||
}
|
||||
}
|
|
@ -122,4 +122,7 @@
|
|||
<data name="SignUp_Label" xml:space="preserve">
|
||||
<value>Registrieren</value>
|
||||
</data>
|
||||
<data name="Future_Label" xml:space="preserve">
|
||||
<value>In Veröffentlichung</value>
|
||||
</data>
|
||||
</root>
|
|
@ -122,4 +122,7 @@
|
|||
<data name="SignUp_Label" xml:space="preserve">
|
||||
<value>Sign Up</value>
|
||||
</data>
|
||||
<data name="Future_Label" xml:space="preserve">
|
||||
<value>Publishing</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue