diff options
Diffstat (limited to 'client/src/app/videos/+video-edit')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add.component.html | 12 | ||||
-rw-r--r-- | client/src/app/videos/+video-edit/video-add.component.ts | 13 |
2 files changed, 24 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html index 698152ff9..7946c0879 100644 --- a/client/src/app/videos/+video-edit/video-add.component.html +++ b/client/src/app/videos/+video-edit/video-add.component.html | |||
@@ -26,6 +26,18 @@ | |||
26 | </div> | 26 | </div> |
27 | 27 | ||
28 | <div class="form-group"> | 28 | <div class="form-group"> |
29 | <label for="category">Channel</label> | ||
30 | <select class="form-control" id="channelId" formControlName="channelId"> | ||
31 | <option></option> | ||
32 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | ||
33 | </select> | ||
34 | |||
35 | <div *ngIf="formErrors.channelId" class="alert alert-danger"> | ||
36 | {{ formErrors.channelId }} | ||
37 | </div> | ||
38 | </div> | ||
39 | |||
40 | <div class="form-group"> | ||
29 | <label for="category">Category</label> | 41 | <label for="category">Category</label> |
30 | <select class="form-control" id="category" formControlName="category"> | 42 | <select class="form-control" id="category" formControlName="category"> |
31 | <option></option> | 43 | <option></option> |
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 8043bb41c..92b03e8c9 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -12,9 +12,10 @@ import { | |||
12 | VIDEO_LANGUAGE, | 12 | VIDEO_LANGUAGE, |
13 | VIDEO_DESCRIPTION, | 13 | VIDEO_DESCRIPTION, |
14 | VIDEO_TAGS, | 14 | VIDEO_TAGS, |
15 | VIDEO_CHANNEL, | ||
15 | VIDEO_FILE | 16 | VIDEO_FILE |
16 | } from '../../shared' | 17 | } from '../../shared' |
17 | import { ServerService } from '../../core' | 18 | import { AuthService, ServerService } from '../../core' |
18 | import { VideoService } from '../shared' | 19 | import { VideoService } from '../shared' |
19 | import { VideoCreate } from '../../../../../shared' | 20 | import { VideoCreate } from '../../../../../shared' |
20 | import { HttpEventType, HttpResponse } from '@angular/common/http' | 21 | import { HttpEventType, HttpResponse } from '@angular/common/http' |
@@ -33,6 +34,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
33 | videoCategories = [] | 34 | videoCategories = [] |
34 | videoLicences = [] | 35 | videoLicences = [] |
35 | videoLanguages = [] | 36 | videoLanguages = [] |
37 | userVideoChannels = [] | ||
36 | 38 | ||
37 | tagValidators = VIDEO_TAGS.VALIDATORS | 39 | tagValidators = VIDEO_TAGS.VALIDATORS |
38 | tagValidatorsMessages = VIDEO_TAGS.MESSAGES | 40 | tagValidatorsMessages = VIDEO_TAGS.MESSAGES |
@@ -44,6 +46,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
44 | category: '', | 46 | category: '', |
45 | licence: '', | 47 | licence: '', |
46 | language: '', | 48 | language: '', |
49 | channelId: '', | ||
47 | description: '', | 50 | description: '', |
48 | videofile: '' | 51 | videofile: '' |
49 | } | 52 | } |
@@ -52,6 +55,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
52 | category: VIDEO_CATEGORY.MESSAGES, | 55 | category: VIDEO_CATEGORY.MESSAGES, |
53 | licence: VIDEO_LICENCE.MESSAGES, | 56 | licence: VIDEO_LICENCE.MESSAGES, |
54 | language: VIDEO_LANGUAGE.MESSAGES, | 57 | language: VIDEO_LANGUAGE.MESSAGES, |
58 | channelId: VIDEO_CHANNEL.MESSAGES, | ||
55 | description: VIDEO_DESCRIPTION.MESSAGES, | 59 | description: VIDEO_DESCRIPTION.MESSAGES, |
56 | videofile: VIDEO_FILE.MESSAGES | 60 | videofile: VIDEO_FILE.MESSAGES |
57 | } | 61 | } |
@@ -60,6 +64,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
60 | private formBuilder: FormBuilder, | 64 | private formBuilder: FormBuilder, |
61 | private router: Router, | 65 | private router: Router, |
62 | private notificationsService: NotificationsService, | 66 | private notificationsService: NotificationsService, |
67 | private authService: AuthService, | ||
63 | private serverService: ServerService, | 68 | private serverService: ServerService, |
64 | private videoService: VideoService | 69 | private videoService: VideoService |
65 | ) { | 70 | ) { |
@@ -77,6 +82,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
77 | category: [ '', VIDEO_CATEGORY.VALIDATORS ], | 82 | category: [ '', VIDEO_CATEGORY.VALIDATORS ], |
78 | licence: [ '', VIDEO_LICENCE.VALIDATORS ], | 83 | licence: [ '', VIDEO_LICENCE.VALIDATORS ], |
79 | language: [ '', VIDEO_LANGUAGE.VALIDATORS ], | 84 | language: [ '', VIDEO_LANGUAGE.VALIDATORS ], |
85 | channelId: [ this.userVideoChannels[0].id, VIDEO_CHANNEL.VALIDATORS ], | ||
80 | description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], | 86 | description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], |
81 | videofile: [ '', VIDEO_FILE.VALIDATORS ], | 87 | videofile: [ '', VIDEO_FILE.VALIDATORS ], |
82 | tags: [ '' ] | 88 | tags: [ '' ] |
@@ -90,6 +96,9 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
90 | this.videoLicences = this.serverService.getVideoLicences() | 96 | this.videoLicences = this.serverService.getVideoLicences() |
91 | this.videoLanguages = this.serverService.getVideoLanguages() | 97 | this.videoLanguages = this.serverService.getVideoLanguages() |
92 | 98 | ||
99 | const user = this.authService.getUser() | ||
100 | this.userVideoChannels = user.videoChannels.map(v => ({ id: v.id, label: v.name })) | ||
101 | |||
93 | this.buildForm() | 102 | this.buildForm() |
94 | } | 103 | } |
95 | 104 | ||
@@ -122,6 +131,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
122 | const category = formValue.category | 131 | const category = formValue.category |
123 | const licence = formValue.licence | 132 | const licence = formValue.licence |
124 | const language = formValue.language | 133 | const language = formValue.language |
134 | const channelId = formValue.channelId | ||
125 | const description = formValue.description | 135 | const description = formValue.description |
126 | const tags = formValue.tags | 136 | const tags = formValue.tags |
127 | const videofile = this.videofileInput.nativeElement.files[0] | 137 | const videofile = this.videofileInput.nativeElement.files[0] |
@@ -131,6 +141,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
131 | formData.append('category', '' + category) | 141 | formData.append('category', '' + category) |
132 | formData.append('nsfw', '' + nsfw) | 142 | formData.append('nsfw', '' + nsfw) |
133 | formData.append('licence', '' + licence) | 143 | formData.append('licence', '' + licence) |
144 | formData.append('channelId', '' + channelId) | ||
134 | formData.append('videofile', videofile) | 145 | formData.append('videofile', videofile) |
135 | 146 | ||
136 | // Language is optional | 147 | // Language is optional |