bstlboard-front/src/app/pages/search/search.page.html

104 lines
4.2 KiB
HTML

<div class="flex column fill">
<div class="container flex wrap">
<mat-form-field appearance="fill">
<mat-label>{{'search.query' | i18n}}</mat-label>
<input matInput [formControl]="searchFormControl">
</mat-form-field>
<mat-form-field>
<mat-label>{{'search.types' | i18n}}</mat-label>
<mat-select [value]="searchType" (selectionChange)="searchType = $event.value; refresh()">
<mat-select-trigger>
<span *ngIf="searchType">
<mat-icon>{{'search.types.' + searchType + '.icon' | i18n}}</mat-icon> {{'search.types.' +
searchType | i18n}}
</span>
</mat-select-trigger>
<mat-option *ngFor="let type of types" [value]="type">
<span *ngIf="type">
<mat-icon>{{'search.types.' + type + '.icon' | i18n}}</mat-icon> {{'search.types.' + type | i18n}}
</span>
<span *ngIf="!type">
{{'search.types.all' | i18n}}
</span>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>{{'search.byDate' | i18n}}</mat-label>
<mat-select [value]="byDate" (selectionChange)="byDate = $event.value; refresh()">
<mat-select-trigger>
<mat-icon>{{'search.byDate.' + byDate + '.icon' | i18n}}</mat-icon> {{'search.byDate.' +
byDate | i18n}}
</mat-select-trigger>
<mat-option [value]="false">
<mat-icon>{{'search.byDate.false.icon' | i18n}}</mat-icon>
{{'search.byDate.false' | i18n}}
</mat-option>
<mat-option [value]="true">
<mat-icon>{{'search.byDate.true.icon' | i18n}}</mat-icon>
{{'search.byDate.true' | i18n}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>{{'search.asc' | i18n}}</mat-label>
<mat-select [value]="asc" (selectionChange)="asc = $event.value; refresh()">
<mat-select-trigger>
<mat-icon>{{'search.asc.' + asc + '.icon' | i18n}}</mat-icon> {{'search.asc.' +
asc | i18n}}
</mat-select-trigger>
<mat-option [value]="false">
<mat-icon>{{'search.asc.false.icon' | i18n}}</mat-icon>
{{'search.asc.false' | i18n}}
</mat-option>
<mat-option [value]="true">
<mat-icon>{{'search.asc.true.icon' | i18n}}</mat-icon>
{{'search.asc.true' | i18n}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<mat-progress-bar *ngIf="!results || !results.content && !results.error" mode="indeterminate"></mat-progress-bar>
<div *ngIf="results && results.error" class="flex column fill">
<mat-card class="accent box">
<mat-card-header>
<mat-card-title>{{ 'search.error.' + results.error.status | i18n}}</mat-card-title>
<mat-card-subtitle>{{'search.error' | i18n}}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>
{{ 'search.error.' + results.error.status + '.text' | i18n}}
</p>
</mat-card-content>
</mat-card>
</div>
<ng-container *ngIf="results">
<mat-list *ngIf="results.content" class="scroll-container">
<ng-container *ngFor="let result of results.content; let i = index">
<mat-divider *ngIf="i > 0"></mat-divider>
<mat-list-item>
<ui-entry *ngIf="result.type == 'entry'" class="entry" [entry]="result"
[index]="i+1 + results.number*results.size" [change]="boundRefresh" [text]="true" [actions]="false">
</ui-entry>
<ui-comment *ngIf="result.type == 'comment'" class="comment" [comment]="result"
[index]="i+1 + results.number*results.size" [change]="boundRefresh" [subcomments]="false"
[parentLink]="true" [actions]="false"></ui-comment>
</mat-list-item>
</ng-container>
</mat-list>
<mat-list *ngIf="results.totalElements == 0">
<mat-list-item>
<p>{{'search.nothing' | i18n}}</p>
</mat-list-item>
</mat-list>
<span class="spacer"></span>
<mat-paginator [pageSizeOptions]="pageSizeOptions" [pageIndex]="results.number" [length]="results.totalElements"
[pageSize]="results.size" (page)="update && update($event)" showFirstLastButtons>
</mat-paginator>
</ng-container>
</div>