aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-add/video-add.component.html
blob: 6b2eb9377df4e350cca02ebe15778afa62bca097 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<h3>Upload a video</h3>

<div *ngIf="error" class="alert alert-danger">{{ error }}</div>

<form novalidate (ngSubmit)="upload()" [ngFormModel]="videoForm">
  <div class="form-group">
    <label for="name">Name</label>
    <input
      type="text" class="form-control" name="name" id="name"
      ngControl="name" #name="ngForm" [(ngModel)]="video.name"
    >
    <div [hidden]="name.valid || name.pristine" class="alert alert-warning">
      A name is required and should be between 3 and 50 characters long
    </div>
  </div>

  <div class="form-group">
    <label for="tags">Tags</label>
    <input
      type="text" class="form-control" name="tags" id="tags"
      ngControl="tags" #tags="ngForm" [disabled]="isTagsInputDisabled" (keyup)="onTagKeyPress($event)" [(ngModel)]="currentTag"
    >
    <div [hidden]="tags.valid || tags.pristine" class="alert alert-warning">
      A tag should be between 2 and 10 characters long
    </div>
  </div>

  <div class="tags">
    <div class="label label-info tag" *ngFor="let tag of video.tags">
      {{ tag }}
      <span class="remove" (click)="removeTag(tag)">x</span>
    </div>
  </div>

  <div class="form-group">
    <label for="videofile">File</label>
    <div class="btn btn-default btn-file" [ngClass]="{ 'disabled': filename !== null }" >
      <span>Select the video...</span>
      <input
        type="file" name="videofile" id="videofile"
        ng2FileSelect [uploader]="uploader" [disabled]="filename !== null"
      >
    </div>
  </div>

  <div class="file-to-upload">
    <div class="file" *ngIf="uploader.queue.length > 0">
      <span class="filename">{{ filename }}</span>
      <span class="glyphicon glyphicon-remove" (click)="removeFile()"></span>
    </div>
  </div>

  <div class="form-group">
    <label for="description">Description</label>
    <textarea
      name="description" id="description" class="form-control" placeholder="Description..."
      ngControl="description"  #description="ngForm" [(ngModel)]="video.description"
    >
    </textarea>
    <div [hidden]="description.valid || description.pristine" class="alert alert-warning">
        A description is required and should be between 3 and 250 characters long
    </div>
  </div>

  <div class="progress">
    <progressbar [value]="uploader.progress" max="100"></progressbar>
  </div>

  <div class="form-group">
    <input
      type="submit" value="Upload" class="btn btn-default form-control" [title]="getInvalidFieldsTitle()"
      [disabled]="!videoForm.valid || video.tags.length === 0 || filename === null"
    >
  </div>
</form>