87 lines
3.6 KiB
HTML
87 lines
3.6 KiB
HTML
<div class="container">
|
|
<mat-progress-bar *ngIf="!view" mode="indeterminate"></mat-progress-bar>
|
|
<form [formGroup]="form" (ngSubmit)="save()" #formDirective="ngForm" *ngIf="view && settings">
|
|
<mat-card>
|
|
<mat-card-content>
|
|
<p>{{ (view.id ? 'views.edit' : 'views.create') | i18n}}</p>
|
|
|
|
<mat-form-field>
|
|
<mat-label>{{'views.name' | i18n}}</mat-label>
|
|
<input matInput formControlName="name" matAutofocus>
|
|
<mat-error *ngIf="hasError('name')">
|
|
<div *ngFor="let error of form.get('name').errors | keyvalue">
|
|
{{'views.name.error.' + error.key | i18n}}<br>
|
|
</div>
|
|
</mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field>
|
|
<mat-label>{{'views.sorting' | i18n}}</mat-label>
|
|
<mat-select formControlName="sorting">
|
|
<mat-select-trigger>
|
|
<mat-icon>{{'sorting.' + sorting + '.icon' | i18n}}</mat-icon> {{'sorting.' + sorting | i18n}}
|
|
</mat-select-trigger>
|
|
<mat-option *ngFor="let sorting of sortings" [value]="sorting">
|
|
<mat-icon>{{'sorting.' + sorting + '.icon' | i18n}}</mat-icon> {{'sorting.' + sorting | i18n}}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
|
|
<ui-tagspicker [(model)]="view.tags" placeholder="{{'views.tags' | i18n}}">
|
|
</ui-tagspicker>
|
|
|
|
<ui-tagspicker [(model)]="view.excludedTags" placeholder="{{'views.excludedTags' | i18n}}">
|
|
</ui-tagspicker>
|
|
|
|
<mat-form-field>
|
|
<mat-label>{{'views.entryType' | i18n}}</mat-label>
|
|
<mat-select formControlName="entryType">
|
|
<mat-select-trigger>
|
|
<span *ngIf="entryType">
|
|
<mat-icon>{{'entryType.' + entryType + '.icon' | i18n}}</mat-icon> {{'entryType.' +
|
|
entryType | i18n}}
|
|
</span>
|
|
</mat-select-trigger>
|
|
<mat-option *ngFor="let entryType of entryTypes" [value]="entryType">
|
|
<span *ngIf="entryType">
|
|
<mat-icon>{{'entryType.' + entryType + '.icon' | i18n}}</mat-icon> {{'entryType.' + entryType | i18n}}
|
|
</span>
|
|
<span *ngIf="!entryType">
|
|
{{'entryType.empty' | i18n}}
|
|
</span>
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field>
|
|
<mat-label>{{'views.index' | i18n}}</mat-label>
|
|
<input matInput formControlName="index" type="number" min="0">
|
|
<mat-error *ngIf="hasError('index')">
|
|
<div *ngFor="let error of form.get('index').errors | keyvalue">
|
|
{{'views.index.error.' + error.key | i18n}}<br>
|
|
</div>
|
|
</mat-error>
|
|
</mat-form-field>
|
|
|
|
<section>
|
|
<mat-checkbox [checked]="view.divider" (change)="view.divider = $event.checked">{{'views.divider'
|
|
| i18n}}</mat-checkbox>
|
|
</section>
|
|
|
|
</mat-card-content>
|
|
<mat-card-actions class="flex wrap fill">
|
|
<button type="submit" *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
|
|
<mat-icon>save</mat-icon> {{ (view.id ? 'views.update' : 'views.create') | i18n}}
|
|
</button>
|
|
<a mat-button color="primary" routerLink="/v/{{view.name}}" *ngIf="view.id">{{ 'views.goTo' |
|
|
i18n}}</a>
|
|
<span class="spacer"></span>
|
|
<a mat-raised-button color="warn" *ngIf="!working && view.id" (click)="deleteView()">
|
|
<mat-icon>delete</mat-icon> {{
|
|
'views.delete' |
|
|
i18n}}
|
|
</a>
|
|
</mat-card-actions>
|
|
</mat-card>
|
|
</form>
|
|
</div> |