85 lines
2.5 KiB
HTML
85 lines
2.5 KiB
HTML
<div class="page">
|
|
<div>
|
|
<h6>Nachrichten</h6>
|
|
<p>Aktuelle Nachrichten aus Campus-Aktuell.</p>
|
|
</div>
|
|
|
|
<div class="news-toolbar">
|
|
<mat-form-field appearance="outline" class="search-field">
|
|
<mat-icon matPrefix>search</mat-icon>
|
|
<input
|
|
matInput
|
|
[formControl]="searchControl"
|
|
placeholder="Nachrichten durchsuchen..." />
|
|
</mat-form-field>
|
|
|
|
@if (!isSearching) {
|
|
<mat-form-field appearance="outline" class="sort-field">
|
|
<mat-select
|
|
[value]="sortOrder"
|
|
(selectionChange)="onSortChange($event.value)">
|
|
<mat-option value="desc">Neueste zuerst</mat-option>
|
|
<mat-option value="asc">Älteste zuerst</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
}
|
|
</div>
|
|
|
|
<div class="table-wrap">
|
|
@if (loading) {
|
|
<div class="loading">
|
|
<mat-spinner diameter="36"></mat-spinner>
|
|
</div>
|
|
}
|
|
|
|
<table mat-table [dataSource]="articles" class="mat-elevation-z2">
|
|
<ng-container matColumnDef="maintitle">
|
|
<th mat-header-cell *matHeaderCellDef>Titel</th>
|
|
<td mat-cell *matCellDef="let article">
|
|
<a class="article-title" [routerLink]="['/news', article.id]">{{
|
|
article.maintitle || 'Kein Titel'
|
|
}}</a>
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="author">
|
|
<th mat-header-cell *matHeaderCellDef>Autor</th>
|
|
<td mat-cell *matCellDef="let article">
|
|
{{ article.author || '-' }}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="date">
|
|
<th mat-header-cell *matHeaderCellDef>Datum</th>
|
|
<td mat-cell *matCellDef="let article">
|
|
{{ formatDate(article.date) }}
|
|
</td>
|
|
</ng-container>
|
|
|
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
|
</table>
|
|
|
|
@if (!loading && articles.length === 0) {
|
|
<div class="empty-state">
|
|
@if (isSearching) {
|
|
Keine Ergebnisse für „{{ searchControl.value.trim() }}" gefunden.
|
|
} @else {
|
|
Keine Nachrichten gefunden.
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
<div class="table-footer">
|
|
<span>{{ articleRange() }}</span>
|
|
<mat-paginator
|
|
[length]="total"
|
|
[pageIndex]="currentPage - 1"
|
|
[pageSize]="paginationService.selection"
|
|
[pageSizeOptions]="paginationService.options"
|
|
(page)="onPage($event)">
|
|
</mat-paginator>
|
|
</div>
|
|
</div>
|