From d07137b90b2b2b0c1e93a6f0e7bf8719b133027c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 27 Mar 2017 21:11:37 +0200 Subject: Client: add support for video licences --- client/src/app/videos/shared/video.model.ts | 3 +++ client/src/app/videos/shared/video.service.ts | 14 ++++++++++++++ client/src/app/videos/video-add/video-add.component.html | 12 ++++++++++++ client/src/app/videos/video-add/video-add.component.ts | 8 ++++++++ .../src/app/videos/video-watch/video-watch.component.html | 7 +++++++ .../src/app/videos/video-watch/video-watch.component.scss | 4 ++++ 6 files changed, 48 insertions(+) (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index b5d96f63a..5ed622dce 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts @@ -3,6 +3,7 @@ export class Video { by: string; createdAt: Date; categoryLabel: string; + licenceLabel: string; description: string; duration: string; id: string; @@ -33,6 +34,7 @@ export class Video { author: string, createdAt: string, categoryLabel: string, + licenceLabel: string, description: string, duration: number; id: string, @@ -49,6 +51,7 @@ export class Video { this.author = hash.author; this.createdAt = new Date(hash.createdAt); this.categoryLabel = hash.categoryLabel; + this.licenceLabel = hash.licenceLabel; 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 debc114aa..15f017e33 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -23,6 +23,7 @@ export class VideoService { private static BASE_VIDEO_URL = '/api/v1/videos/'; videoCategories: Array<{ id: number, label: string }> = []; + videoLicences: Array<{ id: number, label: string }> = []; constructor( private authService: AuthService, @@ -45,6 +46,19 @@ export class VideoService { }); } + loadVideoLicences() { + return this.http.get(VideoService.BASE_VIDEO_URL + 'licences') + .map(this.restExtractor.extractDataGet) + .subscribe(data => { + Object.keys(data).forEach(licenceKey => { + this.videoLicences.push({ + id: parseInt(licenceKey), + label: data[licenceKey] + }); + }); + }); + } + getVideo(id: string): Observable