From: Chocobozzz Date: Fri, 7 Apr 2017 12:57:05 +0000 (+0200) Subject: Client: support video language X-Git-Tag: v0.0.1-alpha~479 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=db216afd980846c418a4ebab8190c3ead561dfc1;p=oweals%2Fpeertube.git Client: support video language --- diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 3c06b320e..c29790d96 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -42,6 +42,7 @@ export class AppComponent implements OnInit { this.configService.loadConfig(); this.videoService.loadVideoCategories(); this.videoService.loadVideoLicences(); + this.videoService.loadVideoLanguages(); } isInAdmin() { diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts index 50d7304b5..293fd805f 100644 --- a/client/src/app/shared/forms/form-validators/video.ts +++ b/client/src/app/shared/forms/form-validators/video.ts @@ -23,6 +23,11 @@ export const VIDEO_LICENCE = { } }; +export const VIDEO_LANGUAGE = { + VALIDATORS: [ ], + MESSAGES: {} +}; + export const VIDEO_DESCRIPTION = { VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(250) ], MESSAGES: { diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index 3c588c446..f135ca707 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts @@ -6,6 +6,7 @@ export class Video { createdAt: Date; categoryLabel: string; licenceLabel: string; + languageLabel: string; description: string; duration: string; id: string; @@ -38,6 +39,7 @@ export class Video { createdAt: string, categoryLabel: string, licenceLabel: string, + languageLabel: string; description: string, duration: number; id: string, @@ -56,6 +58,7 @@ export class Video { this.createdAt = new Date(hash.createdAt); this.categoryLabel = hash.categoryLabel; this.licenceLabel = hash.licenceLabel; + this.languageLabel = hash.languageLabel; this.description = hash.description; this.duration = Video.createDurationString(hash.duration); this.id = hash.id; diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index 15f017e33..13d4ca246 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -24,6 +24,7 @@ export class VideoService { videoCategories: Array<{ id: number, label: string }> = []; videoLicences: Array<{ id: number, label: string }> = []; + videoLanguages: Array<{ id: number, label: string }> = []; constructor( private authService: AuthService, @@ -59,6 +60,19 @@ export class VideoService { }); } + loadVideoLanguages() { + return this.http.get(VideoService.BASE_VIDEO_URL + 'languages') + .map(this.restExtractor.extractDataGet) + .subscribe(data => { + Object.keys(data).forEach(languageKey => { + this.videoLanguages.push({ + id: parseInt(languageKey), + label: data[languageKey] + }); + }); + }); + } + getVideo(id: string): Observable