aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 16:54:44 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 16:59:56 +0100
commit5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 (patch)
treeacbb14fda82b7517734f22d4ca57fb5e1ff9ef04 /client/src/app/videos
parent7ddd02c9b8c1e088f6679a2227f105e6439fc992 (diff)
downloadPeerTube-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')
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.ts18
-rw-r--r--client/src/app/videos/video-watch/video-report.component.ts14
2 files changed, 19 insertions, 13 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
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications';
4 4
5import { ConfirmService } from '../../core';
5import { SortField, Video, VideoService } from '../shared'; 6import { SortField, Video, VideoService } from '../shared';
6import { User } from '../../shared'; 7import { 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}
diff --git a/client/src/app/videos/video-watch/video-report.component.ts b/client/src/app/videos/video-watch/video-report.component.ts
index 19a7af148..7906fdb5c 100644
--- a/client/src/app/videos/video-watch/video-report.component.ts
+++ b/client/src/app/videos/video-watch/video-report.component.ts
@@ -57,13 +57,13 @@ export class VideoReportComponent extends FormReactive implements OnInit {
57 const reason = this.form.value['reason'] 57 const reason = this.form.value['reason']
58 58
59 this.videoAbuseService.reportVideo(this.video.id, reason) 59 this.videoAbuseService.reportVideo(this.video.id, reason)
60 .subscribe( 60 .subscribe(
61 () => { 61 () => {
62 this.notificationsService.success('Success', 'Video reported.'); 62 this.notificationsService.success('Success', 'Video reported.');
63 this.hide(); 63 this.hide();
64 }, 64 },
65 65
66 err => this.notificationsService.error('Error', err.text); 66 err => this.notificationsService.error('Error', err.text)
67 ) 67 );
68 } 68 }
69} 69}