diff options
Diffstat (limited to 'client/src/app/videos/+video-watch')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | 24 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/modal/video-report.component.ts | 21 |
2 files changed, 10 insertions, 35 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 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | ||
3 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
4 | import { Observable } from 'rxjs' | 3 | import { Observable } from 'rxjs' |
5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 4 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' |
@@ -10,6 +9,7 @@ import { Video } from '../../../shared/video/video.model' | |||
10 | import { VideoComment } from './video-comment.model' | 9 | import { VideoComment } from './video-comment.model' |
11 | import { VideoCommentService } from './video-comment.service' | 10 | import { VideoCommentService } from './video-comment.service' |
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | 11 | import { I18n } from '@ngx-translate/i18n-polyfill' |
12 | import { 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() |
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' | |||
5 | import { FormReactive, VIDEO_ABUSE_REASON, VideoAbuseService } from '../../../shared/index' | 5 | import { FormReactive, VIDEO_ABUSE_REASON, VideoAbuseService } from '../../../shared/index' |
6 | import { VideoDetails } from '../../../shared/video/video-details.model' | 6 | import { VideoDetails } from '../../../shared/video/video-details.model' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared' | ||
9 | import { 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 () { |