]>
Commit | Line | Data |
---|---|---|
2539932e C |
1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { AuthService } from '@app/core' | |
8ee25e17 C |
3 | import { Video, VideoService } from '../../shared-main' |
4 | import { MiniatureDisplayOptions } from '../../shared-video-miniature' | |
2539932e C |
5 | |
6 | /* | |
7 | * Markup component that creates a video miniature only | |
8 | */ | |
9 | ||
10 | @Component({ | |
11 | selector: 'my-video-miniature-markup', | |
12 | templateUrl: 'video-miniature-markup.component.html', | |
13 | styleUrls: [ 'video-miniature-markup.component.scss' ] | |
14 | }) | |
15 | export class VideoMiniatureMarkupComponent implements OnInit { | |
16 | @Input() uuid: string | |
9105634f | 17 | @Input() onlyDisplayTitle: boolean |
2539932e C |
18 | |
19 | video: Video | |
20 | ||
21 | displayOptions: MiniatureDisplayOptions = { | |
22 | date: true, | |
23 | views: true, | |
24 | by: true, | |
25 | avatar: false, | |
26 | privacyLabel: false, | |
27 | privacyText: false, | |
28 | state: false, | |
29 | blacklistInfo: false | |
30 | } | |
31 | ||
32 | constructor ( | |
33 | private auth: AuthService, | |
34 | private videoService: VideoService | |
35 | ) { } | |
36 | ||
37 | getUser () { | |
38 | return this.auth.getUser() | |
39 | } | |
40 | ||
41 | ngOnInit () { | |
9105634f C |
42 | if (this.onlyDisplayTitle) { |
43 | for (const key of Object.keys(this.displayOptions)) { | |
44 | this.displayOptions[key] = false | |
45 | } | |
46 | } | |
47 | ||
2539932e C |
48 | this.videoService.getVideo({ videoId: this.uuid }) |
49 | .subscribe(video => this.video = video) | |
50 | } | |
51 | } |