59 lines
2.6 KiB
HTML
59 lines
2.6 KiB
HTML
<div class="container">
|
|
<mat-progress-bar *ngIf="!entry" mode="indeterminate"></mat-progress-bar>
|
|
<form [formGroup]="form" (ngSubmit)="entry.id ? update() : create()" #formDirective="ngForm"
|
|
*ngIf="entry && settings">
|
|
<mat-card>
|
|
<mat-card-content>
|
|
<p>{{ (entry.id ? 'submission.edit' : 'submission.info') | i18n}}</p>
|
|
<mat-form-field>
|
|
<mat-label>{{'submission.entryType' | i18n}}</mat-label>
|
|
<mat-select formControlName="entryType">
|
|
<mat-select-trigger>
|
|
<mat-icon>{{'entryType.' + entryType + '.icon' | i18n}}</mat-icon> {{'entryType.' + entryType | i18n}}
|
|
</mat-select-trigger>
|
|
<mat-option *ngFor="let entryType of entryTypes" [value]="entryType">
|
|
<mat-icon>{{'entryType.' + entryType + '.icon' | i18n}}</mat-icon> {{'entryType.' + entryType | i18n}}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field>
|
|
<mat-label>{{'submission.url' | i18n}}</mat-label>
|
|
<input matInput formControlName="url" type="url" [required]="entryType == 'LINK'" matAutofocus>
|
|
<mat-error *ngIf="hasError('url')">
|
|
{{'submission.url.error' | i18n}}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field>
|
|
<mat-label>{{'submission.title' | i18n}}</mat-label>
|
|
<input matInput formControlName="title" type="text" required (focus)="onTitleFocus($event)">
|
|
<mat-error>
|
|
{{'submission.title.error' | i18n}}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
<mat-form-field>
|
|
<mat-label>{{'submission.text' | i18n}}</mat-label>
|
|
<textarea matAutosize matAutosizeMinRows="3" matInput [required]="entryType != 'LINK'"
|
|
formControlName="text"></textarea>
|
|
<mat-error>
|
|
{{'submission.text.error' | i18n}}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
|
|
<ui-tagspicker [(model)]="entry.tags" placeholder="{{'submission.tags' | i18n}}" [max]="settings.maxTags">
|
|
</ui-tagspicker>
|
|
|
|
</mat-card-content>
|
|
<mat-card-actions>
|
|
<button *ngIf="!working && !entry.id" mat-raised-button color="primary" [disabled]="form.invalid">
|
|
{{'submission.create' | i18n}}
|
|
</button>
|
|
<button *ngIf="!working && entry.id" mat-raised-button color="primary" [disabled]="form.invalid">
|
|
{{'submission.update' | i18n}}
|
|
</button>
|
|
<a *ngIf="success" mat-button color="primary" routerLink="/e/{{entry.id}}">{{'submission.success' | i18n}}</a>
|
|
</mat-card-actions>
|
|
</mat-card>
|
|
</form>
|
|
</div> |