]>
Commit | Line | Data |
---|---|---|
7ed1edbb C |
1 | import { Validators } from '@angular/forms' |
2 | import { BuildFormValidator } from './form-validator.model' | |
27db7840 | 3 | import { USER_USERNAME_VALIDATOR } from './user-validators' |
7ed1edbb C |
4 | |
5 | export const VIDEO_CHANNEL_NAME_VALIDATOR: BuildFormValidator = { | |
27db7840 C |
6 | // Use the same constraints than user usernmae |
7 | VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS, | |
8 | ||
7ed1edbb C |
9 | MESSAGES: { |
10 | 'required': $localize`Name is required.`, | |
11 | 'minlength': $localize`Name must be at least 1 character long.`, | |
12 | 'maxlength': $localize`Name cannot be more than 50 characters long.`, | |
13 | 'pattern': $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.` | |
14 | } | |
15 | } | |
16 | ||
17 | export const VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR: BuildFormValidator = { | |
18 | VALIDATORS: [ | |
19 | Validators.required, | |
20 | Validators.minLength(1), | |
21 | Validators.maxLength(50) | |
22 | ], | |
23 | MESSAGES: { | |
24 | 'required': $localize`Display name is required.`, | |
25 | 'minlength': $localize`Display name must be at least 1 character long.`, | |
26 | 'maxlength': $localize`Display name cannot be more than 50 characters long.` | |
27 | } | |
28 | } | |
29 | ||
30 | export const VIDEO_CHANNEL_DESCRIPTION_VALIDATOR: BuildFormValidator = { | |
31 | VALIDATORS: [ | |
32 | Validators.minLength(3), | |
33 | Validators.maxLength(1000) | |
34 | ], | |
35 | MESSAGES: { | |
36 | 'minlength': $localize`Description must be at least 3 characters long.`, | |
37 | 'maxlength': $localize`Description cannot be more than 1000 characters long.` | |
38 | } | |
39 | } | |
40 | ||
41 | export const VIDEO_CHANNEL_SUPPORT_VALIDATOR: BuildFormValidator = { | |
42 | VALIDATORS: [ | |
43 | Validators.minLength(3), | |
44 | Validators.maxLength(1000) | |
45 | ], | |
46 | MESSAGES: { | |
47 | 'minlength': $localize`Support text must be at least 3 characters long.`, | |
48 | 'maxlength': $localize`Support text cannot be more than 1000 characters long` | |
49 | } | |
50 | } |