2016-05-27 10:23:10 -04:00
|
|
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
2016-05-21 12:03:34 -04:00
|
|
|
|
2017-01-27 10:14:11 -05:00
|
|
|
import { NotificationsService } from 'angular2-notifications';
|
|
|
|
|
2017-04-04 15:37:03 -04:00
|
|
|
import { ConfirmService, ConfigService } from '../../core';
|
2016-07-18 09:39:10 -04:00
|
|
|
import { SortField, Video, VideoService } from '../shared';
|
2016-06-03 16:08:03 -04:00
|
|
|
import { User } from '../../shared';
|
2016-05-21 12:03:34 -04:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'my-video-miniature',
|
2016-09-19 16:49:31 -04:00
|
|
|
styleUrls: [ './video-miniature.component.scss' ],
|
|
|
|
templateUrl: './video-miniature.component.html'
|
2016-05-21 12:03:34 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
export class VideoMiniatureComponent {
|
2016-07-18 09:39:10 -04:00
|
|
|
@Input() currentSort: SortField;
|
2016-05-21 12:03:34 -04:00
|
|
|
@Input() user: User;
|
2016-05-27 11:49:18 -04:00
|
|
|
@Input() video: Video;
|
2016-05-21 12:03:34 -04:00
|
|
|
|
2017-01-27 10:14:11 -05:00
|
|
|
constructor(
|
|
|
|
private notificationsService: NotificationsService,
|
2017-01-27 10:54:44 -05:00
|
|
|
private confirmService: ConfirmService,
|
2017-04-04 15:37:03 -04:00
|
|
|
private configService: ConfigService,
|
2017-01-27 10:14:11 -05:00
|
|
|
private videoService: VideoService
|
|
|
|
) {}
|
2016-05-21 12:03:34 -04:00
|
|
|
|
2017-04-04 15:37:03 -04:00
|
|
|
getVideoName() {
|
|
|
|
if (this.isVideoNSFWForThisUser())
|
|
|
|
return 'NSFW';
|
|
|
|
|
|
|
|
return this.video.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
isVideoNSFWForThisUser() {
|
|
|
|
return this.video.isVideoNSFWForUser(this.user);
|
|
|
|
}
|
2016-05-21 12:03:34 -04:00
|
|
|
}
|