diff options
Diffstat (limited to 'client/src/app/videos')
3 files changed, 25 insertions, 31 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index cd2a26ae3..61515c0b0 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts | |||
@@ -1,20 +1,9 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { FormGroup } from '@angular/forms' | 2 | import { FormGroup, ValidatorFn } from '@angular/forms' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { VIDEO_SUPPORT } from '@app/shared' | 4 | import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | import { ServerService } from '../../../core/server' | 6 | import { ServerService } from '../../../core/server' |
7 | import { VIDEO_CHANNEL } from '../../../shared/forms/form-validators' | ||
8 | import { ValidatorMessage } from '../../../shared/forms/form-validators/validator-message' | ||
9 | import { | ||
10 | VIDEO_CATEGORY, | ||
11 | VIDEO_DESCRIPTION, | ||
12 | VIDEO_LANGUAGE, | ||
13 | VIDEO_LICENCE, | ||
14 | VIDEO_NAME, | ||
15 | VIDEO_PRIVACY, | ||
16 | VIDEO_TAGS | ||
17 | } from '../../../shared/forms/form-validators/video' | ||
18 | import { VideoEdit } from '../../../shared/video/video-edit.model' | 7 | import { VideoEdit } from '../../../shared/video/video-edit.model' |
19 | import { map } from 'rxjs/operators' | 8 | import { map } from 'rxjs/operators' |
20 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 9 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
@@ -28,7 +17,7 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val | |||
28 | export class VideoEditComponent implements OnInit { | 17 | export class VideoEditComponent implements OnInit { |
29 | @Input() form: FormGroup | 18 | @Input() form: FormGroup |
30 | @Input() formErrors: { [ id: string ]: string } = {} | 19 | @Input() formErrors: { [ id: string ]: string } = {} |
31 | @Input() validationMessages: ValidatorMessage = {} | 20 | @Input() validationMessages: FormReactiveValidationMessages = {} |
32 | @Input() videoPrivacies = [] | 21 | @Input() videoPrivacies = [] |
33 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] | 22 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] |
34 | 23 | ||
@@ -37,18 +26,22 @@ export class VideoEditComponent implements OnInit { | |||
37 | videoLanguages = [] | 26 | videoLanguages = [] |
38 | video: VideoEdit | 27 | video: VideoEdit |
39 | 28 | ||
40 | tagValidators = VIDEO_TAGS.VALIDATORS | 29 | tagValidators: ValidatorFn[] |
41 | tagValidatorsMessages = VIDEO_TAGS.MESSAGES | 30 | tagValidatorsMessages: { [ name: string ]: string } |
42 | 31 | ||
43 | error: string = null | 32 | error: string = null |
44 | 33 | ||
45 | constructor ( | 34 | constructor ( |
46 | private formValidatorService: FormValidatorService, | 35 | private formValidatorService: FormValidatorService, |
36 | private videoValidatorsService: VideoValidatorsService, | ||
47 | private route: ActivatedRoute, | 37 | private route: ActivatedRoute, |
48 | private router: Router, | 38 | private router: Router, |
49 | private notificationsService: NotificationsService, | 39 | private notificationsService: NotificationsService, |
50 | private serverService: ServerService | 40 | private serverService: ServerService |
51 | ) { } | 41 | ) { |
42 | this.tagValidators = this.videoValidatorsService.VIDEO_TAGS.VALIDATORS | ||
43 | this.tagValidatorsMessages = this.videoValidatorsService.VIDEO_TAGS.MESSAGES | ||
44 | } | ||
52 | 45 | ||
53 | updateForm () { | 46 | updateForm () { |
54 | const defaultValues = { | 47 | const defaultValues = { |
@@ -57,19 +50,19 @@ export class VideoEditComponent implements OnInit { | |||
57 | tags: [] | 50 | tags: [] |
58 | } | 51 | } |
59 | const obj = { | 52 | const obj = { |
60 | name: VIDEO_NAME, | 53 | name: this.videoValidatorsService.VIDEO_NAME, |
61 | privacy: VIDEO_PRIVACY, | 54 | privacy: this.videoValidatorsService.VIDEO_PRIVACY, |
62 | channelId: VIDEO_CHANNEL, | 55 | channelId: this.videoValidatorsService.VIDEO_CHANNEL, |
63 | nsfw: null, | 56 | nsfw: null, |
64 | commentsEnabled: null, | 57 | commentsEnabled: null, |
65 | category: VIDEO_CATEGORY, | 58 | category: this.videoValidatorsService.VIDEO_CATEGORY, |
66 | licence: VIDEO_LICENCE, | 59 | licence: this.videoValidatorsService.VIDEO_LICENCE, |
67 | language: VIDEO_LANGUAGE, | 60 | language: this.videoValidatorsService.VIDEO_LANGUAGE, |
68 | description: VIDEO_DESCRIPTION, | 61 | description: this.videoValidatorsService.VIDEO_DESCRIPTION, |
69 | tags: null, | 62 | tags: null, |
70 | thumbnailfile: null, | 63 | thumbnailfile: null, |
71 | previewfile: null, | 64 | previewfile: null, |
72 | support: VIDEO_SUPPORT | 65 | support: this.videoValidatorsService.VIDEO_SUPPORT |
73 | } | 66 | } |
74 | 67 | ||
75 | this.formValidatorService.updateForm( | 68 | this.formValidatorService.updateForm( |
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 c70e544a3..46d7a4e9e 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 | |||
@@ -3,13 +3,13 @@ import { NotificationsService } from 'angular2-notifications' | |||
3 | import { Observable } from 'rxjs' | 3 | import { Observable } from 'rxjs' |
4 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 4 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' |
5 | import { FormReactive } from '../../../shared' | 5 | import { FormReactive } from '../../../shared' |
6 | import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' | ||
7 | import { User } from '../../../shared/users' | 6 | import { User } from '../../../shared/users' |
8 | import { Video } from '../../../shared/video/video.model' | 7 | import { Video } from '../../../shared/video/video.model' |
9 | import { VideoComment } from './video-comment.model' | 8 | import { VideoComment } from './video-comment.model' |
10 | import { VideoCommentService } from './video-comment.service' | 9 | import { VideoCommentService } from './video-comment.service' |
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | 10 | import { I18n } from '@ngx-translate/i18n-polyfill' |
12 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 11 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
12 | import { VideoCommentValidatorsService } from '@app/shared/forms/form-validators/video-comment-validators.service' | ||
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'my-video-comment-add', | 15 | selector: 'my-video-comment-add', |
@@ -29,6 +29,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
29 | 29 | ||
30 | constructor ( | 30 | constructor ( |
31 | protected formValidatorService: FormValidatorService, | 31 | protected formValidatorService: FormValidatorService, |
32 | private videoCommentValidatorsService: VideoCommentValidatorsService, | ||
32 | private notificationsService: NotificationsService, | 33 | private notificationsService: NotificationsService, |
33 | private videoCommentService: VideoCommentService, | 34 | private videoCommentService: VideoCommentService, |
34 | private i18n: I18n | 35 | private i18n: I18n |
@@ -38,7 +39,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
38 | 39 | ||
39 | ngOnInit () { | 40 | ngOnInit () { |
40 | this.buildForm({ | 41 | this.buildForm({ |
41 | text: VIDEO_COMMENT_TEXT | 42 | text: this.videoCommentValidatorsService.VIDEO_COMMENT_TEXT |
42 | }) | 43 | }) |
43 | 44 | ||
44 | if (this.focusOnInit === true) { | 45 | if (this.focusOnInit === true) { |
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 8641e8dfb..d9768fdac 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 | |||
@@ -1,12 +1,11 @@ | |||
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' | ||
3 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
4 | import { ModalDirective } from 'ngx-bootstrap/modal' | 3 | import { ModalDirective } from 'ngx-bootstrap/modal' |
5 | import { FormReactive, VIDEO_ABUSE_REASON, VideoAbuseService } from '../../../shared/index' | 4 | import { FormReactive, VideoAbuseService } from '../../../shared/index' |
6 | import { VideoDetails } from '../../../shared/video/video-details.model' | 5 | import { VideoDetails } from '../../../shared/video/video-details.model' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | 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' | 7 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
8 | import { VideoAbuseValidatorsService } from '@app/shared/forms/form-validators/video-abuse-validators.service' | ||
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
12 | selector: 'my-video-report', | 11 | selector: 'my-video-report', |
@@ -22,6 +21,7 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
22 | 21 | ||
23 | constructor ( | 22 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 23 | protected formValidatorService: FormValidatorService, |
24 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, | ||
25 | private videoAbuseService: VideoAbuseService, | 25 | private videoAbuseService: VideoAbuseService, |
26 | private notificationsService: NotificationsService, | 26 | private notificationsService: NotificationsService, |
27 | private i18n: I18n | 27 | private i18n: I18n |
@@ -31,7 +31,7 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
31 | 31 | ||
32 | ngOnInit () { | 32 | ngOnInit () { |
33 | this.buildForm({ | 33 | this.buildForm({ |
34 | reason: VIDEO_ABUSE_REASON | 34 | reason: this.videoAbuseValidatorsService.VIDEO_ABUSE_REASON |
35 | }) | 35 | }) |
36 | } | 36 | } |
37 | 37 | ||