]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-forms/form-validators/instance-validators.service.ts
removed minimum width css to fit mobile devices with lesser width (#3090)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / form-validators / instance-validators.service.ts
CommitLineData
66357162 1import { Injectable } from '@angular/core'
d3e56c0c 2import { Validators } from '@angular/forms'
67ed6552 3import { BuildFormValidator } from './form-validator.service'
d3e56c0c
C
4
5@Injectable()
6export class InstanceValidatorsService {
7 readonly FROM_EMAIL: BuildFormValidator
8 readonly FROM_NAME: BuildFormValidator
4e9fa5b7 9 readonly SUBJECT: BuildFormValidator
d3e56c0c
C
10 readonly BODY: BuildFormValidator
11
66357162 12 constructor () {
d3e56c0c
C
13
14 this.FROM_EMAIL = {
15 VALIDATORS: [ Validators.required, Validators.email ],
16 MESSAGES: {
66357162
C
17 'required': $localize`Email is required.`,
18 'email': $localize`Email must be valid.`
d3e56c0c
C
19 }
20 }
21
22 this.FROM_NAME = {
23 VALIDATORS: [
24 Validators.required,
25 Validators.minLength(1),
26 Validators.maxLength(120)
27 ],
28 MESSAGES: {
66357162
C
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.`
d3e56c0c
C
32 }
33 }
34
4e9fa5b7
NB
35 this.SUBJECT = {
36 VALIDATORS: [
37 Validators.required,
38 Validators.minLength(1),
39 Validators.maxLength(120)
40 ],
41 MESSAGES: {
66357162
C
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.`
4e9fa5b7
NB
45 }
46 }
47
d3e56c0c
C
48 this.BODY = {
49 VALIDATORS: [
50 Validators.required,
51 Validators.minLength(3),
52 Validators.maxLength(5000)
53 ],
54 MESSAGES: {
66357162
C
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.`
d3e56c0c
C
58 }
59 }
60 }
61}