aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.html
blob: f2f69236c79a82ec82a545807a518fc0195ec09c (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
76
77
78
79
80
81
<div class="root">
  <div class="header">
    <div class="first-row">
      <div i18n class="title">Save to</div>
    </div>
  </div>

  <div class="input-container">
    <input type="text" placeholder="Search playlists" i18n-placeholder [(ngModel)]="videoPlaylistSearch" (ngModelChange)="onVideoPlaylistSearchChanged()" />
  </div>

  <div class="playlists">
    <div
      *ngFor="let playlist of videoPlaylists"
      class="playlist dropdown-item" [ngClass]="{ 'has-optional-row': playlist.optionalRowDisplayed }"
    >
      <button class="primary-row button-unstyle" (click)="toggleMainPlaylist($event, playlist)">
        <my-peertube-checkbox
          [disabled]="isPresentMultipleTimes(playlist) || playlist.optionalRowDisplayed" [inputName]="getPrimaryInputName(playlist)"
          [ngModel]="isPrimaryCheckboxChecked(playlist)" [onPushWorkaround]="true"
        ></my-peertube-checkbox>

        <label [for]="getPrimaryInputName(playlist)" class="display-name">
          {{ playlist.displayName }}
        </label>

        <button class="optional-row-icon button-unstyle" *ngIf="isPrimaryCheckboxChecked(playlist)" (click)="$event.stopPropagation(); toggleOptionalRow(playlist)">
          <my-global-icon iconName="add" aria-hidden="true"></my-global-icon>
        </button>
      </button>

      <div class="optional-rows" *ngIf="playlist.optionalRowDisplayed">
        <div class="header-label" i18n>Start at</div>
        <div class="header-label" i18n>Stop at</div>

        <ng-container *ngFor="let element of buildOptionalRowElements(playlist)">
          <my-peertube-checkbox
            [inputName]="getOptionalInputName(playlist, element)"
            [ngModel]="element.enabled" [onPushWorkaround]="true"
            (click)="toggleOptionalPlaylist($event, playlist, element, startAt.timestamp, stopAt.timestamp)"
          ></my-peertube-checkbox>

          <my-timestamp-input
            [maxTimestamp]="video.duration"
            [(ngModel)]="element.startTimestamp"
            (inputBlur)="onElementTimestampUpdate(playlist, element)"
            #startAt
          ></my-timestamp-input>

          <my-timestamp-input
            [maxTimestamp]="video.duration"
            [(ngModel)]="element.stopTimestamp"
            (inputBlur)="onElementTimestampUpdate(playlist, element)"
            #stopAt
          ></my-timestamp-input>
        </ng-container>
      </div>
    </div>
  </div>

  <button class="new-playlist-button dropdown-item" (click)="openCreateBlock($event)" [hidden]="isNewPlaylistBlockOpened">
    <my-global-icon iconName="add" aria-hidden="true"></my-global-icon>

    <span i18n>Create a private playlist</span>
  </button>

  <form class="new-playlist-block dropdown-item" *ngIf="isNewPlaylistBlockOpened" (ngSubmit)="createPlaylist()" [formGroup]="form">
    <div class="form-group">
      <label i18n for="displayName">Display name</label>
      <input
        type="text" id="displayName"
        formControlName="displayName" [ngClass]="{ 'input-error': formErrors['displayName'] }"
      >
      <div *ngIf="formErrors['displayName']" class="form-error">
        {{ formErrors['displayName'] }}
      </div>
    </div>

    <input type="submit" i18n-value value="Create" [disabled]="!form.valid">
  </form>
</div>