Chocobozzz/PeerTube

View on GitHub
client/src/app/shared/shared-moderation/user-ban-modal.component.html

Summary

Maintainability
Test Coverage
<ng-template #modal>
  <div class="modal-header">
    <h4 i18n class="modal-title">{{ getModalTitle() }}</h4>

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

  <div class="modal-body">
    <div class="description" i18n>
      A banned user will no longer be able to login.
    </div>

    <form novalidate [formGroup]="form" (ngSubmit)="banUser()">
      <div class="form-group">
        <textarea
          i18n-placeholder placeholder="Reason..." formControlName="reason"
          class="form-control" [ngClass]="{ 'input-error': formErrors['reason'] }"
        ></textarea>
        <div *ngIf="formErrors.reason" class="form-error" role="alert">
          {{ formErrors.reason }}
        </div>
      </div>

      <div class="form-group">
        <my-peertube-checkbox
          inputName="banMute" formControlName="mute"
          i18n-labelText labelText="Mute to also hide videos/comments"
        >
        </my-peertube-checkbox>
      </div>

      <div class="form-group inputs">
        <input
          type="button" role="button" i18n-value value="Cancel" class="peertube-button grey-button"
          (click)="hide()" (key.enter)="hide()"
        >

        <input type="submit" i18n-value [value]="getModalTitle()" class="peertube-button orange-button" [disabled]="!form.valid" />
      </div>
    </form>
  </div>

</ng-template>