diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-08 08:39:15 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-08 09:57:29 +0100 |
commit | cadb46d832724ea1a17b085b992142aa32e212be (patch) | |
tree | df1972470ab022e95ff5dc7866c78174c36bfa37 /client/src/app/shared | |
parent | c182778e26b8478fae9d7dd0bf0687baf7b72fd1 (diff) | |
download | PeerTube-cadb46d832724ea1a17b085b992142aa32e212be.tar.gz PeerTube-cadb46d832724ea1a17b085b992142aa32e212be.tar.zst PeerTube-cadb46d832724ea1a17b085b992142aa32e212be.zip |
Design second video upload step
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/forms/form-validators/video.ts | 22 | ||||
-rw-r--r-- | client/src/app/shared/video/video-edit.model.ts | 26 | ||||
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 11 |
3 files changed, 26 insertions, 33 deletions
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts index 8e512e8c8..45da7df4a 100644 --- a/client/src/app/shared/forms/form-validators/video.ts +++ b/client/src/app/shared/forms/form-validators/video.ts | |||
@@ -23,17 +23,13 @@ export const VIDEO_PRIVACY = { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | export const VIDEO_CATEGORY = { | 25 | export const VIDEO_CATEGORY = { |
26 | VALIDATORS: [ Validators.required ], | 26 | VALIDATORS: [ ], |
27 | MESSAGES: { | 27 | MESSAGES: {} |
28 | 'required': 'Video category is required.' | ||
29 | } | ||
30 | } | 28 | } |
31 | 29 | ||
32 | export const VIDEO_LICENCE = { | 30 | export const VIDEO_LICENCE = { |
33 | VALIDATORS: [ Validators.required ], | 31 | VALIDATORS: [ ], |
34 | MESSAGES: { | 32 | MESSAGES: {} |
35 | 'required': 'Video licence is required.' | ||
36 | } | ||
37 | } | 33 | } |
38 | 34 | ||
39 | export const VIDEO_LANGUAGE = { | 35 | export const VIDEO_LANGUAGE = { |
@@ -49,9 +45,8 @@ export const VIDEO_CHANNEL = { | |||
49 | } | 45 | } |
50 | 46 | ||
51 | export const VIDEO_DESCRIPTION = { | 47 | export const VIDEO_DESCRIPTION = { |
52 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(3000) ], | 48 | VALIDATORS: [ Validators.minLength(3), Validators.maxLength(3000) ], |
53 | MESSAGES: { | 49 | MESSAGES: { |
54 | 'required': 'Video description is required.', | ||
55 | 'minlength': 'Video description must be at least 3 characters long.', | 50 | 'minlength': 'Video description must be at least 3 characters long.', |
56 | 'maxlength': 'Video description cannot be more than 3000 characters long.' | 51 | 'maxlength': 'Video description cannot be more than 3000 characters long.' |
57 | } | 52 | } |
@@ -64,10 +59,3 @@ export const VIDEO_TAGS = { | |||
64 | 'maxlength': 'A tag should be less than 30 characters long.' | 59 | 'maxlength': 'A tag should be less than 30 characters long.' |
65 | } | 60 | } |
66 | } | 61 | } |
67 | |||
68 | export const VIDEO_FILE = { | ||
69 | VALIDATORS: [ Validators.required ], | ||
70 | MESSAGES: { | ||
71 | 'required': 'Video file is required.' | ||
72 | } | ||
73 | } | ||
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index 88d23a59f..955255bfa 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -14,18 +14,20 @@ export class VideoEdit { | |||
14 | uuid?: string | 14 | uuid?: string |
15 | id?: number | 15 | id?: number |
16 | 16 | ||
17 | constructor (videoDetails: VideoDetails) { | 17 | constructor (videoDetails?: VideoDetails) { |
18 | this.id = videoDetails.id | 18 | if (videoDetails) { |
19 | this.uuid = videoDetails.uuid | 19 | this.id = videoDetails.id |
20 | this.category = videoDetails.category | 20 | this.uuid = videoDetails.uuid |
21 | this.licence = videoDetails.licence | 21 | this.category = videoDetails.category |
22 | this.language = videoDetails.language | 22 | this.licence = videoDetails.licence |
23 | this.description = videoDetails.description | 23 | this.language = videoDetails.language |
24 | this.name = videoDetails.name | 24 | this.description = videoDetails.description |
25 | this.tags = videoDetails.tags | 25 | this.name = videoDetails.name |
26 | this.nsfw = videoDetails.nsfw | 26 | this.tags = videoDetails.tags |
27 | this.channel = videoDetails.channel.id | 27 | this.nsfw = videoDetails.nsfw |
28 | this.privacy = videoDetails.privacy | 28 | this.channel = videoDetails.channel.id |
29 | this.privacy = videoDetails.privacy | ||
30 | } | ||
29 | } | 31 | } |
30 | 32 | ||
31 | patch (values: Object) { | 33 | patch (values: Object) { |
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 3f35b67c4..1a0644c3d 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -42,14 +42,17 @@ export class VideoService { | |||
42 | } | 42 | } |
43 | 43 | ||
44 | updateVideo (video: VideoEdit) { | 44 | updateVideo (video: VideoEdit) { |
45 | const language = video.language ? video.language : null | 45 | const language = video.language || undefined |
46 | const licence = video.licence || undefined | ||
47 | const category = video.category || undefined | ||
48 | const description = video.description || undefined | ||
46 | 49 | ||
47 | const body: VideoUpdate = { | 50 | const body: VideoUpdate = { |
48 | name: video.name, | 51 | name: video.name, |
49 | category: video.category, | 52 | category, |
50 | licence: video.licence, | 53 | licence, |
51 | language, | 54 | language, |
52 | description: video.description, | 55 | description, |
53 | privacy: video.privacy, | 56 | privacy: video.privacy, |
54 | tags: video.tags, | 57 | tags: video.tags, |
55 | nsfw: video.nsfw | 58 | nsfw: video.nsfw |