diff options
Diffstat (limited to 'client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts deleted file mode 100644 index 3628f0b60..000000000 --- a/client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { Validators } from '@angular/forms' | ||
3 | import { BuildFormValidator } from './form-validator.service' | ||
4 | |||
5 | @Injectable() | ||
6 | export class InstanceValidatorsService { | ||
7 | readonly FROM_EMAIL: BuildFormValidator | ||
8 | readonly FROM_NAME: BuildFormValidator | ||
9 | readonly SUBJECT: BuildFormValidator | ||
10 | readonly BODY: BuildFormValidator | ||
11 | |||
12 | constructor () { | ||
13 | |||
14 | this.FROM_EMAIL = { | ||
15 | VALIDATORS: [ Validators.required, Validators.email ], | ||
16 | MESSAGES: { | ||
17 | 'required': $localize`Email is required.`, | ||
18 | 'email': $localize`Email must be valid.` | ||
19 | } | ||
20 | } | ||
21 | |||
22 | this.FROM_NAME = { | ||
23 | VALIDATORS: [ | ||
24 | Validators.required, | ||
25 | Validators.minLength(1), | ||
26 | Validators.maxLength(120) | ||
27 | ], | ||
28 | MESSAGES: { | ||
29 | 'required': $localize`Your name is required.`, | ||
30 | 'minlength': $localize`Your name must be at least 1 character long.`, | ||
31 | 'maxlength': $localize`Your name cannot be more than 120 characters long.` | ||
32 | } | ||
33 | } | ||
34 | |||
35 | this.SUBJECT = { | ||
36 | VALIDATORS: [ | ||
37 | Validators.required, | ||
38 | Validators.minLength(1), | ||
39 | Validators.maxLength(120) | ||
40 | ], | ||
41 | MESSAGES: { | ||
42 | 'required': $localize`A subject is required.`, | ||
43 | 'minlength': $localize`The subject must be at least 1 character long.`, | ||
44 | 'maxlength': $localize`The subject cannot be more than 120 characters long.` | ||
45 | } | ||
46 | } | ||
47 | |||
48 | this.BODY = { | ||
49 | VALIDATORS: [ | ||
50 | Validators.required, | ||
51 | Validators.minLength(3), | ||
52 | Validators.maxLength(5000) | ||
53 | ], | ||
54 | MESSAGES: { | ||
55 | 'required': $localize`A message is required.`, | ||
56 | 'minlength': $localize`The message must be at least 3 characters long.`, | ||
57 | 'maxlength': $localize`The message cannot be more than 5000 characters long.` | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | } | ||