aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/comment
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-watch/comment')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.ts24
1 files changed, 5 insertions, 19 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
index 2ee5f5ef1..c70e544a3 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
@@ -1,5 +1,4 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms'
3import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
4import { Observable } from 'rxjs' 3import { Observable } from 'rxjs'
5import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' 4import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model'
@@ -10,6 +9,7 @@ import { Video } from '../../../shared/video/video.model'
10import { VideoComment } from './video-comment.model' 9import { VideoComment } from './video-comment.model'
11import { VideoCommentService } from './video-comment.service' 10import { VideoCommentService } from './video-comment.service'
12import { I18n } from '@ngx-translate/i18n-polyfill' 11import { I18n } from '@ngx-translate/i18n-polyfill'
12import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
13 13
14@Component({ 14@Component({
15 selector: 'my-video-comment-add', 15 selector: 'my-video-comment-add',
@@ -25,18 +25,10 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
25 25
26 @Output() commentCreated = new EventEmitter<VideoCommentCreate>() 26 @Output() commentCreated = new EventEmitter<VideoCommentCreate>()
27 27
28 form: FormGroup
29 formErrors = {
30 'text': ''
31 }
32 validationMessages = {
33 'text': VIDEO_COMMENT_TEXT.MESSAGES
34 }
35
36 @ViewChild('textarea') private textareaElement: ElementRef 28 @ViewChild('textarea') private textareaElement: ElementRef
37 29
38 constructor ( 30 constructor (
39 private formBuilder: FormBuilder, 31 protected formValidatorService: FormValidatorService,
40 private notificationsService: NotificationsService, 32 private notificationsService: NotificationsService,
41 private videoCommentService: VideoCommentService, 33 private videoCommentService: VideoCommentService,
42 private i18n: I18n 34 private i18n: I18n
@@ -44,16 +36,10 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
44 super() 36 super()
45 } 37 }
46 38
47 buildForm () {
48 this.form = this.formBuilder.group({
49 text: [ '', VIDEO_COMMENT_TEXT.VALIDATORS ]
50 })
51
52 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
53 }
54
55 ngOnInit () { 39 ngOnInit () {
56 this.buildForm() 40 this.buildForm({
41 text: VIDEO_COMMENT_TEXT
42 })
57 43
58 if (this.focusOnInit === true) { 44 if (this.focusOnInit === true) {
59 this.textareaElement.nativeElement.focus() 45 this.textareaElement.nativeElement.focus()