diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 14:32:15 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 14:32:15 +0200 |
commit | df98563e2104b82b119c00a3cd83cd0dc1242d25 (patch) | |
tree | a9720bf01bac9ad5646bd3d3c9bc7653617afdad /client/src/app/shared/forms/form-validators | |
parent | 46757b477c1adb5f98060d15998a3852e18902a6 (diff) | |
download | PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.gz PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.zst PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.zip |
Use typescript standard and lint all files
Diffstat (limited to 'client/src/app/shared/forms/form-validators')
5 files changed, 23 insertions, 23 deletions
diff --git a/client/src/app/shared/forms/form-validators/host.validator.ts b/client/src/app/shared/forms/form-validators/host.validator.ts index ec417e079..03e810fdb 100644 --- a/client/src/app/shared/forms/form-validators/host.validator.ts +++ b/client/src/app/shared/forms/form-validators/host.validator.ts | |||
@@ -1,14 +1,14 @@ | |||
1 | import { FormControl } from '@angular/forms'; | 1 | import { FormControl } from '@angular/forms' |
2 | 2 | ||
3 | export function validateHost(c: FormControl) { | 3 | export function validateHost (c: FormControl) { |
4 | // Thanks to http://stackoverflow.com/a/106223 | 4 | // Thanks to http://stackoverflow.com/a/106223 |
5 | const HOST_REGEXP = new RegExp( | 5 | const HOST_REGEXP = new RegExp( |
6 | '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' | 6 | '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' |
7 | ); | 7 | ) |
8 | 8 | ||
9 | return HOST_REGEXP.test(c.value) ? null : { | 9 | return HOST_REGEXP.test(c.value) ? null : { |
10 | validateHost: { | 10 | validateHost: { |
11 | valid: false | 11 | valid: false |
12 | } | 12 | } |
13 | }; | 13 | } |
14 | } | 14 | } |
diff --git a/client/src/app/shared/forms/form-validators/index.ts b/client/src/app/shared/forms/form-validators/index.ts index ab7c2df31..efe77d4ae 100644 --- a/client/src/app/shared/forms/form-validators/index.ts +++ b/client/src/app/shared/forms/form-validators/index.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | export * from './host.validator'; | 1 | export * from './host.validator' |
2 | export * from './user'; | 2 | export * from './user' |
3 | export * from './video-abuse'; | 3 | export * from './video-abuse' |
4 | export * from './video'; | 4 | export * from './video' |
diff --git a/client/src/app/shared/forms/form-validators/user.ts b/client/src/app/shared/forms/form-validators/user.ts index 259d2b868..fd316583e 100644 --- a/client/src/app/shared/forms/form-validators/user.ts +++ b/client/src/app/shared/forms/form-validators/user.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Validators } from '@angular/forms'; | 1 | import { Validators } from '@angular/forms' |
2 | 2 | ||
3 | export const USER_USERNAME = { | 3 | export const USER_USERNAME = { |
4 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ], | 4 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ], |
@@ -7,18 +7,18 @@ export const USER_USERNAME = { | |||
7 | 'minlength': 'Username must be at least 3 characters long.', | 7 | 'minlength': 'Username must be at least 3 characters long.', |
8 | 'maxlength': 'Username cannot be more than 20 characters long.' | 8 | 'maxlength': 'Username cannot be more than 20 characters long.' |
9 | } | 9 | } |
10 | }; | 10 | } |
11 | export const USER_EMAIL = { | 11 | export const USER_EMAIL = { |
12 | VALIDATORS: [ Validators.required, Validators.email ], | 12 | VALIDATORS: [ Validators.required, Validators.email ], |
13 | MESSAGES: { | 13 | MESSAGES: { |
14 | 'required': 'Email is required.', | 14 | 'required': 'Email is required.', |
15 | 'email': 'Email must be valid.', | 15 | 'email': 'Email must be valid.' |
16 | } | 16 | } |
17 | }; | 17 | } |
18 | export const USER_PASSWORD = { | 18 | export const USER_PASSWORD = { |
19 | VALIDATORS: [ Validators.required, Validators.minLength(6) ], | 19 | VALIDATORS: [ Validators.required, Validators.minLength(6) ], |
20 | MESSAGES: { | 20 | MESSAGES: { |
21 | 'required': 'Password is required.', | 21 | 'required': 'Password is required.', |
22 | 'minlength': 'Password must be at least 6 characters long.', | 22 | 'minlength': 'Password must be at least 6 characters long.' |
23 | } | 23 | } |
24 | }; | 24 | } |
diff --git a/client/src/app/shared/forms/form-validators/video-abuse.ts b/client/src/app/shared/forms/form-validators/video-abuse.ts index 94a29a3b7..3c7f26205 100644 --- a/client/src/app/shared/forms/form-validators/video-abuse.ts +++ b/client/src/app/shared/forms/form-validators/video-abuse.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Validators } from '@angular/forms'; | 1 | import { Validators } from '@angular/forms' |
2 | 2 | ||
3 | export const VIDEO_ABUSE_REASON = { | 3 | export const VIDEO_ABUSE_REASON = { |
4 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(300) ], | 4 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(300) ], |
@@ -7,4 +7,4 @@ export const VIDEO_ABUSE_REASON = { | |||
7 | 'minlength': 'Report reson must be at least 2 characters long.', | 7 | 'minlength': 'Report reson must be at least 2 characters long.', |
8 | 'maxlength': 'Report reson cannot be more than 300 characters long.' | 8 | 'maxlength': 'Report reson cannot be more than 300 characters long.' |
9 | } | 9 | } |
10 | }; | 10 | } |
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts index f7e4e5e4b..6542cf8f6 100644 --- a/client/src/app/shared/forms/form-validators/video.ts +++ b/client/src/app/shared/forms/form-validators/video.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Validators } from '@angular/forms'; | 1 | import { Validators } from '@angular/forms' |
2 | 2 | ||
3 | export const VIDEO_NAME = { | 3 | export const VIDEO_NAME = { |
4 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(50) ], | 4 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(50) ], |
@@ -7,26 +7,26 @@ export const VIDEO_NAME = { | |||
7 | 'minlength': 'Video name must be at least 3 characters long.', | 7 | 'minlength': 'Video name must be at least 3 characters long.', |
8 | 'maxlength': 'Video name cannot be more than 50 characters long.' | 8 | 'maxlength': 'Video name cannot be more than 50 characters long.' |
9 | } | 9 | } |
10 | }; | 10 | } |
11 | 11 | ||
12 | export const VIDEO_CATEGORY = { | 12 | export const VIDEO_CATEGORY = { |
13 | VALIDATORS: [ Validators.required ], | 13 | VALIDATORS: [ Validators.required ], |
14 | MESSAGES: { | 14 | MESSAGES: { |
15 | 'required': 'Video category is required.' | 15 | 'required': 'Video category is required.' |
16 | } | 16 | } |
17 | }; | 17 | } |
18 | 18 | ||
19 | export const VIDEO_LICENCE = { | 19 | export const VIDEO_LICENCE = { |
20 | VALIDATORS: [ Validators.required ], | 20 | VALIDATORS: [ Validators.required ], |
21 | MESSAGES: { | 21 | MESSAGES: { |
22 | 'required': 'Video licence is required.' | 22 | 'required': 'Video licence is required.' |
23 | } | 23 | } |
24 | }; | 24 | } |
25 | 25 | ||
26 | export const VIDEO_LANGUAGE = { | 26 | export const VIDEO_LANGUAGE = { |
27 | VALIDATORS: [ ], | 27 | VALIDATORS: [ ], |
28 | MESSAGES: {} | 28 | MESSAGES: {} |
29 | }; | 29 | } |
30 | 30 | ||
31 | export const VIDEO_DESCRIPTION = { | 31 | export const VIDEO_DESCRIPTION = { |
32 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(250) ], | 32 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(250) ], |
@@ -35,7 +35,7 @@ export const VIDEO_DESCRIPTION = { | |||
35 | 'minlength': 'Video description must be at least 3 characters long.', | 35 | 'minlength': 'Video description must be at least 3 characters long.', |
36 | 'maxlength': 'Video description cannot be more than 250 characters long.' | 36 | 'maxlength': 'Video description cannot be more than 250 characters long.' |
37 | } | 37 | } |
38 | }; | 38 | } |
39 | 39 | ||
40 | export const VIDEO_TAGS = { | 40 | export const VIDEO_TAGS = { |
41 | VALIDATORS: [ Validators.minLength(2), Validators.maxLength(10) ], | 41 | VALIDATORS: [ Validators.minLength(2), Validators.maxLength(10) ], |
@@ -43,4 +43,4 @@ export const VIDEO_TAGS = { | |||
43 | 'minlength': 'A tag should be more than 2 characters long.', | 43 | 'minlength': 'A tag should be more than 2 characters long.', |
44 | 'maxlength': 'A tag should be less than 10 characters long.' | 44 | 'maxlength': 'A tag should be less than 10 characters long.' |
45 | } | 45 | } |
46 | }; | 46 | } |