]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/forms/form-validators/video.ts
Move video form inside a component
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-validators / video.ts
CommitLineData
df98563e 1import { Validators } from '@angular/forms'
4b2f33f3 2
ff249f49
C
3export type ValidatorMessage = {
4 [ id: string ]: {
5 [ error: string ]: string
6 }
7}
8
4b2f33f3 9export const VIDEO_NAME = {
a265f7f3 10 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
4b2f33f3
C
11 MESSAGES: {
12 'required': 'Video name is required.',
13 'minlength': 'Video name must be at least 3 characters long.',
a265f7f3 14 'maxlength': 'Video name cannot be more than 120 characters long.'
4b2f33f3 15 }
df98563e 16}
d07137b9 17
fd45e8f4
C
18export const VIDEO_PRIVACY = {
19 VALIDATORS: [ Validators.required ],
20 MESSAGES: {
21 'required': 'Video privacy is required.'
22 }
23}
24
6e07c3de
C
25export const VIDEO_CATEGORY = {
26 VALIDATORS: [ Validators.required ],
27 MESSAGES: {
28 'required': 'Video category is required.'
29 }
df98563e 30}
d07137b9
C
31
32export const VIDEO_LICENCE = {
33 VALIDATORS: [ Validators.required ],
34 MESSAGES: {
35 'required': 'Video licence is required.'
36 }
df98563e 37}
d07137b9 38
db216afd
C
39export const VIDEO_LANGUAGE = {
40 VALIDATORS: [ ],
41 MESSAGES: {}
df98563e 42}
db216afd 43
bcd9f81e
C
44export const VIDEO_CHANNEL = {
45 VALIDATORS: [ Validators.required ],
46 MESSAGES: {
47 'required': 'Video channel is required.'
48 }
49}
50
4b2f33f3 51export const VIDEO_DESCRIPTION = {
2de96f4d 52 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(3000) ],
4b2f33f3
C
53 MESSAGES: {
54 'required': 'Video description is required.',
55 'minlength': 'Video description must be at least 3 characters long.',
2de96f4d 56 'maxlength': 'Video description cannot be more than 3000 characters long.'
4b2f33f3 57 }
df98563e 58}
4b2f33f3
C
59
60export const VIDEO_TAGS = {
a265f7f3 61 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
4b2f33f3 62 MESSAGES: {
3758da94 63 'minlength': 'A tag should be more than 2 characters long.',
a265f7f3 64 'maxlength': 'A tag should be less than 30 characters long.'
4b2f33f3 65 }
df98563e 66}
bfb3a98f
C
67
68export const VIDEO_FILE = {
69 VALIDATORS: [ Validators.required ],
70 MESSAGES: {
71 'required': 'Video file is required.'
72 }
73}