Bernd-L/exDateMan

View on GitHub
frontend/src/app/components/edit-thing/edit-thing.component.html

Summary

Maintainability
Test Coverage
<span class="mat-typography" *ngIf="unauthorized">
  <h2>Unauthorized</h2>
  We couldn't fetch this thing, because you aren't authorized. <br />
  Try logging in again to resolve this. <br />
  <br />
  Redirecting you to the login page in 3 seconds...
</span>

<span *ngIf="!unauthorized">
  <span class="mat-typography" *ngIf="loading && !notFound">
    <h2>Loading thing...</h2>
    We're getting your thing... <br />
    Please hang on
  </span>

  <span *ngIf="!notFound && !loading">
    <form [formGroup]="form" (ngSubmit)="onEditThing()">
      <mat-form-field appearance="outline">
        <mat-label>Thing name</mat-label>
        <input
          matInput
          type="text"
          placeholder="Tomato"
          formControlName="name"
          required
        />
        <i matSuffix class="material-icons">crop_free</i>
        <!-- <mat-hint>Hint</mat-hint> -->
      </mat-form-field>
      <br />

      <button
        mat-raised-button
        type="submit"
        (click)="onEditThing()"
        color="accent"
        [disabled]="!form.valid"
      >
        Save changes
      </button>
      &nbsp;
      <button
        mat-raised-button
        type="button"
        (click)="onDeleteThing()"
        color="warn"
      >
        Delete
      </button>
    </form>
  </span>

  <div *ngIf="notFound" class="mat-typography">
    <h2>
      Oh, no.
    </h2>
    We couldn't find the data you requested.
  </div>
</span>