diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:54:44 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:59:56 +0100 |
commit | 5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 (patch) | |
tree | acbb14fda82b7517734f22d4ca57fb5e1ff9ef04 /client/src/app/videos/video-list | |
parent | 7ddd02c9b8c1e088f6679a2227f105e6439fc992 (diff) | |
download | PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.tar.gz PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.tar.zst PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.zip |
Client: better confirm box for a beautiful world
Diffstat (limited to 'client/src/app/videos/video-list')
-rw-r--r-- | client/src/app/videos/video-list/video-miniature.component.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts index ca4afc451..ba4715597 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | 3 | import { NotificationsService } from 'angular2-notifications'; |
4 | 4 | ||
5 | import { ConfirmService } from '../../core'; | ||
5 | import { SortField, Video, VideoService } from '../shared'; | 6 | import { SortField, Video, VideoService } from '../shared'; |
6 | import { User } from '../../shared'; | 7 | import { User } from '../../shared'; |
7 | 8 | ||
@@ -22,6 +23,7 @@ export class VideoMiniatureComponent { | |||
22 | 23 | ||
23 | constructor( | 24 | constructor( |
24 | private notificationsService: NotificationsService, | 25 | private notificationsService: NotificationsService, |
26 | private confirmService: ConfirmService, | ||
25 | private videoService: VideoService | 27 | private videoService: VideoService |
26 | ) {} | 28 | ) {} |
27 | 29 | ||
@@ -38,12 +40,16 @@ export class VideoMiniatureComponent { | |||
38 | } | 40 | } |
39 | 41 | ||
40 | removeVideo(id: string) { | 42 | removeVideo(id: string) { |
41 | if (confirm('Do you really want to remove this video?')) { | 43 | this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( |
42 | this.videoService.removeVideo(id).subscribe( | 44 | res => { |
43 | status => this.removed.emit(true), | 45 | if (res === false) return; |
44 | 46 | ||
45 | error => this.notificationsService.error('Error', error.text) | 47 | this.videoService.removeVideo(id).subscribe( |
46 | ); | 48 | status => this.removed.emit(true), |
47 | } | 49 | |
50 | error => this.notificationsService.error('Error', error.text) | ||
51 | ); | ||
52 | } | ||
53 | ); | ||
48 | } | 54 | } |
49 | } | 55 | } |