aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/modal
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-05 10:58:45 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 10:58:45 +0200
commitd18d64787b3ea174f7dc2740c8c8c9555625047e (patch)
treee65089e0ca81117c1ada981b9b8a524afa8d70f5 /client/src/app/videos/+video-watch/modal
parent25acef90a85c1584880dec96aa402f896af8364a (diff)
downloadPeerTube-d18d64787b3ea174f7dc2740c8c8c9555625047e.tar.gz
PeerTube-d18d64787b3ea174f7dc2740c8c8c9555625047e.tar.zst
PeerTube-d18d64787b3ea174f7dc2740c8c8c9555625047e.zip
Form validators refractoring
Diffstat (limited to 'client/src/app/videos/+video-watch/modal')
-rw-r--r--client/src/app/videos/+video-watch/modal/video-report.component.ts21
1 files changed, 5 insertions, 16 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-report.component.ts b/client/src/app/videos/+video-watch/modal/video-report.component.ts
index 1bbd30226..8641e8dfb 100644
--- a/client/src/app/videos/+video-watch/modal/video-report.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-report.component.ts
@@ -5,6 +5,8 @@ import { ModalDirective } from 'ngx-bootstrap/modal'
5import { FormReactive, VIDEO_ABUSE_REASON, VideoAbuseService } from '../../../shared/index' 5import { FormReactive, VIDEO_ABUSE_REASON, VideoAbuseService } from '../../../shared/index'
6import { VideoDetails } from '../../../shared/video/video-details.model' 6import { VideoDetails } from '../../../shared/video/video-details.model'
7import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
8import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared'
9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
8 10
9@Component({ 11@Component({
10 selector: 'my-video-report', 12 selector: 'my-video-report',
@@ -17,16 +19,9 @@ export class VideoReportComponent extends FormReactive implements OnInit {
17 @ViewChild('modal') modal: ModalDirective 19 @ViewChild('modal') modal: ModalDirective
18 20
19 error: string = null 21 error: string = null
20 form: FormGroup
21 formErrors = {
22 reason: ''
23 }
24 validationMessages = {
25 reason: VIDEO_ABUSE_REASON.MESSAGES
26 }
27 22
28 constructor ( 23 constructor (
29 private formBuilder: FormBuilder, 24 protected formValidatorService: FormValidatorService,
30 private videoAbuseService: VideoAbuseService, 25 private videoAbuseService: VideoAbuseService,
31 private notificationsService: NotificationsService, 26 private notificationsService: NotificationsService,
32 private i18n: I18n 27 private i18n: I18n
@@ -35,15 +30,9 @@ export class VideoReportComponent extends FormReactive implements OnInit {
35 } 30 }
36 31
37 ngOnInit () { 32 ngOnInit () {
38 this.buildForm() 33 this.buildForm({
39 } 34 reason: VIDEO_ABUSE_REASON
40
41 buildForm () {
42 this.form = this.formBuilder.group({
43 reason: [ '', VIDEO_ABUSE_REASON.VALIDATORS ]
44 }) 35 })
45
46 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
47 } 36 }
48 37
49 show () { 38 show () {