Chocobozzz/PeerTube

View on GitHub
client/src/app/modal/confirm.component.html

Summary

Maintainability
Test Coverage
<ng-template #confirmModal let-close="close" let-dismiss="dismiss">

  <div class="modal-header">
    <h4 class="modal-title">{{ title }}</h4>

    <button class="border-0 p-0" title="Close this modal" i18n-title (click)="dismiss()">
      <my-global-icon iconName="cross"></my-global-icon>
    </button>
  </div>

  <div class="modal-body" >
    <div [innerHtml]="message"></div>

    <div *ngIf="inputLabel" class="form-group mt-3">
      <label for="confirmInput">{{ inputLabel }}</label>

      <input
        *ngIf="!isPasswordInput" type="text"
        myAutofocus id="confirmInput" name="confirmInput"
        [(ngModel)]="inputValue" (keyup.enter)="confirm()"
      />

      <my-input-text
        *ngIf="isPasswordInput" [autofocus]="true" autocomplete="on"
        inputId="confirmInput" [(ngModel)]="inputValue" (keyup.enter)="confirm()"
      ></my-input-text>
    </div>

    <div *ngIf="hasError()" class="text-danger">{{ errorMessage }}</div>
  </div>

  <div class="modal-footer inputs">
    <input
      type="button" role="button" i18n-value value="Cancel" class="peertube-button grey-button"
      (click)="dismiss()" (key.enter)="dismiss()"
    >

    <input
      ngbAutofocus
      type="submit" [value]="confirmButtonText" class="peertube-button orange-button" [disabled]="isConfirmationDisabled()"
      (click)="close()" (key.enter)="confirm()"
    >
  </div>
</ng-template>