diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 14:32:15 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 14:32:15 +0200 |
commit | df98563e2104b82b119c00a3cd83cd0dc1242d25 (patch) | |
tree | a9720bf01bac9ad5646bd3d3c9bc7653617afdad /client/src/app/videos/video-watch/video-report.component.ts | |
parent | 46757b477c1adb5f98060d15998a3852e18902a6 (diff) | |
download | PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.gz PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.zst PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.zip |
Use typescript standard and lint all files
Diffstat (limited to 'client/src/app/videos/video-watch/video-report.component.ts')
-rw-r--r-- | client/src/app/videos/video-watch/video-report.component.ts | 56 |
1 files changed, 28 insertions, 28 deletions
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 528005b84..61213cd68 100644 --- a/client/src/app/videos/video-watch/video-report.component.ts +++ b/client/src/app/videos/video-watch/video-report.component.ts | |||
@@ -1,69 +1,69 @@ | |||
1 | import { Component, Input, OnInit, ViewChild } from '@angular/core'; | 1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms'; | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | 3 | ||
4 | import { ModalDirective } from 'ngx-bootstrap/modal'; | 4 | import { ModalDirective } from 'ngx-bootstrap/modal' |
5 | import { NotificationsService } from 'angular2-notifications'; | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | 6 | ||
7 | import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared'; | 7 | import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared' |
8 | import { Video, VideoService } from '../shared'; | 8 | import { Video, VideoService } from '../shared' |
9 | 9 | ||
10 | @Component({ | 10 | @Component({ |
11 | selector: 'my-video-report', | 11 | selector: 'my-video-report', |
12 | templateUrl: './video-report.component.html' | 12 | templateUrl: './video-report.component.html' |
13 | }) | 13 | }) |
14 | export class VideoReportComponent extends FormReactive implements OnInit { | 14 | export class VideoReportComponent extends FormReactive implements OnInit { |
15 | @Input() video: Video = null; | 15 | @Input() video: Video = null |
16 | 16 | ||
17 | @ViewChild('modal') modal: ModalDirective; | 17 | @ViewChild('modal') modal: ModalDirective |
18 | 18 | ||
19 | error: string = null; | 19 | error: string = null |
20 | form: FormGroup; | 20 | form: FormGroup |
21 | formErrors = { | 21 | formErrors = { |
22 | reason: '' | 22 | reason: '' |
23 | }; | 23 | } |
24 | validationMessages = { | 24 | validationMessages = { |
25 | reason: VIDEO_ABUSE_REASON.MESSAGES | 25 | reason: VIDEO_ABUSE_REASON.MESSAGES |
26 | }; | 26 | } |
27 | 27 | ||
28 | constructor( | 28 | constructor ( |
29 | private formBuilder: FormBuilder, | 29 | private formBuilder: FormBuilder, |
30 | private videoAbuseService: VideoAbuseService, | 30 | private videoAbuseService: VideoAbuseService, |
31 | private notificationsService: NotificationsService | 31 | private notificationsService: NotificationsService |
32 | ) { | 32 | ) { |
33 | super(); | 33 | super() |
34 | } | 34 | } |
35 | 35 | ||
36 | ngOnInit() { | 36 | ngOnInit () { |
37 | this.buildForm(); | 37 | this.buildForm() |
38 | } | 38 | } |
39 | 39 | ||
40 | buildForm() { | 40 | buildForm () { |
41 | this.form = this.formBuilder.group({ | 41 | this.form = this.formBuilder.group({ |
42 | reason: [ '', VIDEO_ABUSE_REASON.VALIDATORS ] | 42 | reason: [ '', VIDEO_ABUSE_REASON.VALIDATORS ] |
43 | }); | 43 | }) |
44 | 44 | ||
45 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)); | 45 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) |
46 | } | 46 | } |
47 | 47 | ||
48 | show() { | 48 | show () { |
49 | this.modal.show(); | 49 | this.modal.show() |
50 | } | 50 | } |
51 | 51 | ||
52 | hide() { | 52 | hide () { |
53 | this.modal.hide(); | 53 | this.modal.hide() |
54 | } | 54 | } |
55 | 55 | ||
56 | report() { | 56 | report () { |
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 | } |