diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-05 14:16:48 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-05 14:16:48 +0200 |
commit | 8dfceec44a5eec8b0190d1d5076aab0f03a0cb52 (patch) | |
tree | 70ff676157240702a2013f2f6d705bfc342a8a81 /client/src/app/shared/video-playlist | |
parent | 3a0fb65c61f80b510bce979a45d59d17948745e8 (diff) | |
download | PeerTube-8dfceec44a5eec8b0190d1d5076aab0f03a0cb52.tar.gz PeerTube-8dfceec44a5eec8b0190d1d5076aab0f03a0cb52.tar.zst PeerTube-8dfceec44a5eec8b0190d1d5076aab0f03a0cb52.zip |
video add to playlist component -> onpush strategy
Diffstat (limited to 'client/src/app/shared/video-playlist')
3 files changed, 20 insertions, 7 deletions
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html index 6029b3648..648d580fa 100644 --- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html +++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html | |||
@@ -42,7 +42,7 @@ | |||
42 | </div> | 42 | </div> |
43 | 43 | ||
44 | <div class="playlist dropdown-item" *ngFor="let playlist of videoPlaylists" (click)="togglePlaylist($event, playlist)"> | 44 | <div class="playlist dropdown-item" *ngFor="let playlist of videoPlaylists" (click)="togglePlaylist($event, playlist)"> |
45 | <my-peertube-checkbox [inputName]="'in-playlist-' + playlist.id" [(ngModel)]="playlist.inPlaylist"></my-peertube-checkbox> | 45 | <my-peertube-checkbox [inputName]="'in-playlist-' + playlist.id" [(ngModel)]="playlist.inPlaylist" [onPushWorkaround]="true"></my-peertube-checkbox> |
46 | 46 | ||
47 | <div class="display-name"> | 47 | <div class="display-name"> |
48 | {{ playlist.displayName }} | 48 | {{ playlist.displayName }} |
@@ -56,7 +56,7 @@ | |||
56 | <div class="new-playlist-button dropdown-item" (click)="openCreateBlock($event)" [hidden]="isNewPlaylistBlockOpened"> | 56 | <div class="new-playlist-button dropdown-item" (click)="openCreateBlock($event)" [hidden]="isNewPlaylistBlockOpened"> |
57 | <my-global-icon iconName="add"></my-global-icon> | 57 | <my-global-icon iconName="add"></my-global-icon> |
58 | 58 | ||
59 | Create a new playlist | 59 | Create a private playlist |
60 | </div> | 60 | </div> |
61 | 61 | ||
62 | <form class="new-playlist-block dropdown-item" *ngIf="isNewPlaylistBlockOpened" (ngSubmit)="createPlaylist()" [formGroup]="form"> | 62 | <form class="new-playlist-block dropdown-item" *ngIf="isNewPlaylistBlockOpened" (ngSubmit)="createPlaylist()" [formGroup]="form"> |
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss b/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss index 0424e2ee9..c677fea6c 100644 --- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss +++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | .options-row { | 41 | .options-row { |
42 | margin-top: 10px; | 42 | margin-top: 10px; |
43 | padding-left: 10px; | ||
43 | 44 | ||
44 | > div { | 45 | > div { |
45 | display: flex; | 46 | display: flex; |
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts index 152f20c85..7dcdf7a9e 100644 --- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts +++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core' |
2 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 2 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { forkJoin } from 'rxjs' | 4 | import { forkJoin } from 'rxjs' |
@@ -19,7 +19,8 @@ type PlaylistSummary = { | |||
19 | @Component({ | 19 | @Component({ |
20 | selector: 'my-video-add-to-playlist', | 20 | selector: 'my-video-add-to-playlist', |
21 | styleUrls: [ './video-add-to-playlist.component.scss' ], | 21 | styleUrls: [ './video-add-to-playlist.component.scss' ], |
22 | templateUrl: './video-add-to-playlist.component.html' | 22 | templateUrl: './video-add-to-playlist.component.html', |
23 | changeDetection: ChangeDetectionStrategy.OnPush | ||
23 | }) | 24 | }) |
24 | export class VideoAddToPlaylistComponent extends FormReactive implements OnInit { | 25 | export class VideoAddToPlaylistComponent extends FormReactive implements OnInit { |
25 | @Input() video: Video | 26 | @Input() video: Video |
@@ -42,7 +43,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
42 | private notifier: Notifier, | 43 | private notifier: Notifier, |
43 | private i18n: I18n, | 44 | private i18n: I18n, |
44 | private videoPlaylistService: VideoPlaylistService, | 45 | private videoPlaylistService: VideoPlaylistService, |
45 | private videoPlaylistValidatorsService: VideoPlaylistValidatorsService | 46 | private videoPlaylistValidatorsService: VideoPlaylistValidatorsService, |
47 | private cd: ChangeDetectorRef | ||
46 | ) { | 48 | ) { |
47 | super() | 49 | super() |
48 | } | 50 | } |
@@ -79,6 +81,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
79 | stopTimestamp: existingPlaylist ? existingPlaylist.stopTimestamp : undefined | 81 | stopTimestamp: existingPlaylist ? existingPlaylist.stopTimestamp : undefined |
80 | }) | 82 | }) |
81 | } | 83 | } |
84 | |||
85 | this.cd.markForCheck() | ||
82 | } | 86 | } |
83 | ) | 87 | ) |
84 | } | 88 | } |
@@ -107,6 +111,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
107 | 111 | ||
108 | playlist.inPlaylist = !playlist.inPlaylist | 112 | playlist.inPlaylist = !playlist.inPlaylist |
109 | this.resetOptions() | 113 | this.resetOptions() |
114 | |||
115 | this.cd.markForCheck() | ||
110 | } | 116 | } |
111 | 117 | ||
112 | createPlaylist () { | 118 | createPlaylist () { |
@@ -126,6 +132,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
126 | }) | 132 | }) |
127 | 133 | ||
128 | this.isNewPlaylistBlockOpened = false | 134 | this.isNewPlaylistBlockOpened = false |
135 | |||
136 | this.cd.markForCheck() | ||
129 | }, | 137 | }, |
130 | 138 | ||
131 | err => this.notifier.error(err.message) | 139 | err => this.notifier.error(err.message) |
@@ -165,7 +173,9 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
165 | this.notifier.error(err.message) | 173 | this.notifier.error(err.message) |
166 | 174 | ||
167 | playlist.inPlaylist = true | 175 | playlist.inPlaylist = true |
168 | } | 176 | }, |
177 | |||
178 | () => this.cd.markForCheck() | ||
169 | ) | 179 | ) |
170 | } | 180 | } |
171 | 181 | ||
@@ -194,7 +204,9 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
194 | this.notifier.error(err.message) | 204 | this.notifier.error(err.message) |
195 | 205 | ||
196 | playlist.inPlaylist = false | 206 | playlist.inPlaylist = false |
197 | } | 207 | }, |
208 | |||
209 | () => this.cd.markForCheck() | ||
198 | ) | 210 | ) |
199 | } | 211 | } |
200 | } | 212 | } |