diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-05 10:52:27 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-05 10:53:09 +0200 |
commit | 3a0fb65c61f80b510bce979a45d59d17948745e8 (patch) | |
tree | c1be0b2158a008fea826835c8d2fd4e8d648bae9 /client/src/app/videos/+video-watch/video-watch.component.ts | |
parent | 693263e936763a851e3c8c020e3739def8bd4eca (diff) | |
download | PeerTube-3a0fb65c61f80b510bce979a45d59d17948745e8.tar.gz PeerTube-3a0fb65c61f80b510bce979a45d59d17948745e8.tar.zst PeerTube-3a0fb65c61f80b510bce979a45d59d17948745e8.zip |
Add video miniature dropdown
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 75 |
1 files changed, 3 insertions, 72 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index cedbbf985..53673d9d9 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -13,10 +13,7 @@ import { AuthService, ConfirmService } from '../../core' | |||
13 | import { RestExtractor, VideoBlacklistService } from '../../shared' | 13 | import { RestExtractor, VideoBlacklistService } from '../../shared' |
14 | import { VideoDetails } from '../../shared/video/video-details.model' | 14 | import { VideoDetails } from '../../shared/video/video-details.model' |
15 | import { VideoService } from '../../shared/video/video.service' | 15 | import { VideoService } from '../../shared/video/video.service' |
16 | import { VideoDownloadComponent } from './modal/video-download.component' | ||
17 | import { VideoReportComponent } from './modal/video-report.component' | ||
18 | import { VideoShareComponent } from './modal/video-share.component' | 16 | import { VideoShareComponent } from './modal/video-share.component' |
19 | import { VideoBlacklistComponent } from './modal/video-blacklist.component' | ||
20 | import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' | 17 | import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' |
21 | import { I18n } from '@ngx-translate/i18n-polyfill' | 18 | import { I18n } from '@ngx-translate/i18n-polyfill' |
22 | import { environment } from '../../../environments/environment' | 19 | import { environment } from '../../../environments/environment' |
@@ -32,6 +29,7 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
32 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 29 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
33 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 30 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
34 | import { Video } from '@app/shared/video/video.model' | 31 | import { Video } from '@app/shared/video/video.model' |
32 | import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component' | ||
35 | 33 | ||
36 | @Component({ | 34 | @Component({ |
37 | selector: 'my-video-watch', | 35 | selector: 'my-video-watch', |
@@ -41,11 +39,8 @@ import { Video } from '@app/shared/video/video.model' | |||
41 | export class VideoWatchComponent implements OnInit, OnDestroy { | 39 | export class VideoWatchComponent implements OnInit, OnDestroy { |
42 | private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern' | 40 | private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern' |
43 | 41 | ||
44 | @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent | ||
45 | @ViewChild('videoShareModal') videoShareModal: VideoShareComponent | 42 | @ViewChild('videoShareModal') videoShareModal: VideoShareComponent |
46 | @ViewChild('videoReportModal') videoReportModal: VideoReportComponent | ||
47 | @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent | 43 | @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent |
48 | @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent | ||
49 | @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent | 44 | @ViewChild('subscribeButton') subscribeButton: SubscribeButtonComponent |
50 | 45 | ||
51 | player: any | 46 | player: any |
@@ -212,11 +207,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
212 | ) | 207 | ) |
213 | } | 208 | } |
214 | 209 | ||
215 | showReportModal (event: Event) { | ||
216 | event.preventDefault() | ||
217 | this.videoReportModal.show() | ||
218 | } | ||
219 | |||
220 | showSupportModal () { | 210 | showSupportModal () { |
221 | this.videoSupportModal.show() | 211 | this.videoSupportModal.show() |
222 | } | 212 | } |
@@ -225,54 +215,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
225 | this.videoShareModal.show(this.currentTime) | 215 | this.videoShareModal.show(this.currentTime) |
226 | } | 216 | } |
227 | 217 | ||
228 | showDownloadModal (event: Event) { | ||
229 | event.preventDefault() | ||
230 | this.videoDownloadModal.show() | ||
231 | } | ||
232 | |||
233 | showBlacklistModal (event: Event) { | ||
234 | event.preventDefault() | ||
235 | this.videoBlacklistModal.show() | ||
236 | } | ||
237 | |||
238 | async unblacklistVideo (event: Event) { | ||
239 | event.preventDefault() | ||
240 | |||
241 | const confirmMessage = this.i18n( | ||
242 | 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.' | ||
243 | ) | ||
244 | |||
245 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist')) | ||
246 | if (res === false) return | ||
247 | |||
248 | this.videoBlacklistService.removeVideoFromBlacklist(this.video.id).subscribe( | ||
249 | () => { | ||
250 | this.notifier.success(this.i18n('Video {{name}} removed from the blacklist.', { name: this.video.name })) | ||
251 | |||
252 | this.video.blacklisted = false | ||
253 | this.video.blacklistedReason = null | ||
254 | }, | ||
255 | |||
256 | err => this.notifier.error(err.message) | ||
257 | ) | ||
258 | } | ||
259 | |||
260 | isUserLoggedIn () { | 218 | isUserLoggedIn () { |
261 | return this.authService.isLoggedIn() | 219 | return this.authService.isLoggedIn() |
262 | } | 220 | } |
263 | 221 | ||
264 | isVideoUpdatable () { | ||
265 | return this.video.isUpdatableBy(this.authService.getUser()) | ||
266 | } | ||
267 | |||
268 | isVideoBlacklistable () { | ||
269 | return this.video.isBlackistableBy(this.user) | ||
270 | } | ||
271 | |||
272 | isVideoUnblacklistable () { | ||
273 | return this.video.isUnblacklistableBy(this.user) | ||
274 | } | ||
275 | |||
276 | getVideoTags () { | 222 | getVideoTags () { |
277 | if (!this.video || Array.isArray(this.video.tags) === false) return [] | 223 | if (!this.video || Array.isArray(this.video.tags) === false) return [] |
278 | 224 | ||
@@ -283,23 +229,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
283 | return this.video.isRemovableBy(this.authService.getUser()) | 229 | return this.video.isRemovableBy(this.authService.getUser()) |
284 | } | 230 | } |
285 | 231 | ||
286 | async removeVideo (event: Event) { | 232 | onVideoRemoved () { |
287 | event.preventDefault() | 233 | this.redirectService.redirectToHomepage() |
288 | |||
289 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete')) | ||
290 | if (res === false) return | ||
291 | |||
292 | this.videoService.removeVideo(this.video.id) | ||
293 | .subscribe( | ||
294 | () => { | ||
295 | this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: this.video.name })) | ||
296 | |||
297 | // Go back to the video-list. | ||
298 | this.redirectService.redirectToHomepage() | ||
299 | }, | ||
300 | |||
301 | error => this.notifier.error(error.message) | ||
302 | ) | ||
303 | } | 234 | } |
304 | 235 | ||
305 | acceptedPrivacyConcern () { | 236 | acceptedPrivacyConcern () { |