diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-17 15:45:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | 8a19bee1a1ee39f973bb37429e4f73c3f2873cdb (patch) | |
tree | 33c93ef19451d7e46d4be74ce0681359d2dcc70e /client/src/app/shared/forms/form-validators | |
parent | 965c4b22d0e4d2f853501e844e6ebbb861bd389d (diff) | |
download | PeerTube-8a19bee1a1ee39f973bb37429e4f73c3f2873cdb.tar.gz PeerTube-8a19bee1a1ee39f973bb37429e4f73c3f2873cdb.tar.zst PeerTube-8a19bee1a1ee39f973bb37429e4f73c3f2873cdb.zip |
Add ability to set a name to a channel
Diffstat (limited to 'client/src/app/shared/forms/form-validators')
-rw-r--r-- | client/src/app/shared/forms/form-validators/video-channel-validators.service.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts b/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts index 28b063f89..1ce3a0dca 100644 --- a/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts +++ b/client/src/app/shared/forms/form-validators/video-channel-validators.service.ts | |||
@@ -5,11 +5,27 @@ import { BuildFormValidator } from '@app/shared' | |||
5 | 5 | ||
6 | @Injectable() | 6 | @Injectable() |
7 | export class VideoChannelValidatorsService { | 7 | export class VideoChannelValidatorsService { |
8 | readonly VIDEO_CHANNEL_NAME: BuildFormValidator | ||
8 | readonly VIDEO_CHANNEL_DISPLAY_NAME: BuildFormValidator | 9 | readonly VIDEO_CHANNEL_DISPLAY_NAME: BuildFormValidator |
9 | readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator | 10 | readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator |
10 | readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator | 11 | readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator |
11 | 12 | ||
12 | constructor (private i18n: I18n) { | 13 | constructor (private i18n: I18n) { |
14 | this.VIDEO_CHANNEL_NAME = { | ||
15 | VALIDATORS: [ | ||
16 | Validators.required, | ||
17 | Validators.minLength(3), | ||
18 | Validators.maxLength(20), | ||
19 | Validators.pattern(/^[a-z0-9._]+$/) | ||
20 | ], | ||
21 | MESSAGES: { | ||
22 | 'required': this.i18n('Name is required.'), | ||
23 | 'minlength': this.i18n('Name must be at least 3 characters long.'), | ||
24 | 'maxlength': this.i18n('Name cannot be more than 20 characters long.'), | ||
25 | 'pattern': this.i18n('Name should be only lowercase alphanumeric characters.') | ||
26 | } | ||
27 | } | ||
28 | |||
13 | this.VIDEO_CHANNEL_DISPLAY_NAME = { | 29 | this.VIDEO_CHANNEL_DISPLAY_NAME = { |
14 | VALIDATORS: [ | 30 | VALIDATORS: [ |
15 | Validators.required, | 31 | Validators.required, |