From 8a19bee1a1ee39f973bb37429e4f73c3f2873cdb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 17 Aug 2018 15:45:42 +0200 Subject: Add ability to set a name to a channel --- .../form-validators/video-channel-validators.service.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'client/src/app/shared/forms') 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' @Injectable() export class VideoChannelValidatorsService { + readonly VIDEO_CHANNEL_NAME: BuildFormValidator readonly VIDEO_CHANNEL_DISPLAY_NAME: BuildFormValidator readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator constructor (private i18n: I18n) { + this.VIDEO_CHANNEL_NAME = { + VALIDATORS: [ + Validators.required, + Validators.minLength(3), + Validators.maxLength(20), + Validators.pattern(/^[a-z0-9._]+$/) + ], + MESSAGES: { + 'required': this.i18n('Name is required.'), + 'minlength': this.i18n('Name must be at least 3 characters long.'), + 'maxlength': this.i18n('Name cannot be more than 20 characters long.'), + 'pattern': this.i18n('Name should be only lowercase alphanumeric characters.') + } + } + this.VIDEO_CHANNEL_DISPLAY_NAME = { VALIDATORS: [ Validators.required, -- cgit v1.2.3