aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts')
-rw-r--r--client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts32
1 files changed, 7 insertions, 25 deletions
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
index a4073728b..e38eaae9c 100644
--- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
+++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' 4import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit'
5import { FormBuilder, FormGroup } from '@angular/forms'
6import { VideoChannelCreate } from '../../../../../shared/models/videos' 5import { VideoChannelCreate } from '../../../../../shared/models/videos'
7import { 6import {
8 VIDEO_CHANNEL_DESCRIPTION, 7 VIDEO_CHANNEL_DESCRIPTION,
@@ -12,6 +11,7 @@ import {
12import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' 11import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
13import { AuthService } from '@app/core' 12import { AuthService } from '@app/core'
14import { I18n } from '@ngx-translate/i18n-polyfill' 13import { I18n } from '@ngx-translate/i18n-polyfill'
14import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
15 15
16@Component({ 16@Component({
17 selector: 'my-account-video-channel-create', 17 selector: 'my-account-video-channel-create',
@@ -21,41 +21,23 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
21export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelEdit implements OnInit { 21export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelEdit implements OnInit {
22 error: string 22 error: string
23 23
24 form: FormGroup
25 formErrors = {
26 'display-name': '',
27 'description': '',
28 'support': ''
29 }
30 validationMessages = {
31 'display-name': VIDEO_CHANNEL_DISPLAY_NAME.MESSAGES,
32 'description': VIDEO_CHANNEL_DESCRIPTION.MESSAGES,
33 'support': VIDEO_CHANNEL_SUPPORT.MESSAGES
34 }
35
36 constructor ( 24 constructor (
25 protected formValidatorService: FormValidatorService,
37 private authService: AuthService, 26 private authService: AuthService,
38 private notificationsService: NotificationsService, 27 private notificationsService: NotificationsService,
39 private router: Router, 28 private router: Router,
40 private formBuilder: FormBuilder,
41 private videoChannelService: VideoChannelService, 29 private videoChannelService: VideoChannelService,
42 private i18n: I18n 30 private i18n: I18n
43 ) { 31 ) {
44 super() 32 super()
45 } 33 }
46 34
47 buildForm () {
48 this.form = this.formBuilder.group({
49 'display-name': [ '', VIDEO_CHANNEL_DISPLAY_NAME.VALIDATORS ],
50 description: [ '', VIDEO_CHANNEL_DESCRIPTION.VALIDATORS ],
51 support: [ '', VIDEO_CHANNEL_SUPPORT.VALIDATORS ]
52 })
53
54 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
55 }
56
57 ngOnInit () { 35 ngOnInit () {
58 this.buildForm() 36 this.buildForm({
37 'display-name': VIDEO_CHANNEL_DISPLAY_NAME,
38 description: VIDEO_CHANNEL_DESCRIPTION,
39 support: VIDEO_CHANNEL_SUPPORT
40 })
59 } 41 }
60 42
61 formValidated () { 43 formValidated () {