]>
Commit | Line | Data |
---|---|---|
41a2aee3 | 1 | import { Component, Input, Output, EventEmitter } from '@angular/core'; |
501bc6c2 | 2 | |
7ddd02c9 C |
3 | import { NotificationsService } from 'angular2-notifications'; |
4 | ||
92fb909c | 5 | import { ConfirmService, ConfigService } from '../../core'; |
bddab65a | 6 | import { SortField, Video, VideoService } from '../shared'; |
4a6995be | 7 | import { User } from '../../shared'; |
501bc6c2 C |
8 | |
9 | @Component({ | |
10 | selector: 'my-video-miniature', | |
ec8d8440 C |
11 | styleUrls: [ './video-miniature.component.scss' ], |
12 | templateUrl: './video-miniature.component.html' | |
501bc6c2 C |
13 | }) |
14 | ||
15 | export class VideoMiniatureComponent { | |
bddab65a | 16 | @Input() currentSort: SortField; |
501bc6c2 | 17 | @Input() user: User; |
4fd8aa32 | 18 | @Input() video: Video; |
501bc6c2 | 19 | |
ccf6ed16 | 20 | hovering = false; |
501bc6c2 | 21 | |
7ddd02c9 C |
22 | constructor( |
23 | private notificationsService: NotificationsService, | |
5769e1db | 24 | private confirmService: ConfirmService, |
92fb909c | 25 | private configService: ConfigService, |
7ddd02c9 C |
26 | private videoService: VideoService |
27 | ) {} | |
501bc6c2 | 28 | |
92fb909c C |
29 | getVideoName() { |
30 | if (this.isVideoNSFWForThisUser()) | |
31 | return 'NSFW'; | |
32 | ||
33 | return this.video.name; | |
34 | } | |
35 | ||
501bc6c2 C |
36 | onBlur() { |
37 | this.hovering = false; | |
38 | } | |
39 | ||
4fd8aa32 C |
40 | onHover() { |
41 | this.hovering = true; | |
501bc6c2 C |
42 | } |
43 | ||
92fb909c C |
44 | isVideoNSFWForThisUser() { |
45 | return this.video.isVideoNSFWForUser(this.user); | |
46 | } | |
501bc6c2 | 47 | } |