]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/video-list/video-miniature.component.ts
Merge branch 'master' into webseed-merged
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-miniature.component.ts
1 import { Component, Input, Output, EventEmitter } from '@angular/core';
2
3 import { SortField, Video, VideoService } from '../shared';
4 import { User } from '../../shared';
5
6 @Component({
7 selector: 'my-video-miniature',
8 styleUrls: [ './video-miniature.component.scss' ],
9 templateUrl: './video-miniature.component.html'
10 })
11
12 export class VideoMiniatureComponent {
13 @Output() removed = new EventEmitter<any>();
14
15 @Input() currentSort: SortField;
16 @Input() user: User;
17 @Input() video: Video;
18
19 hovering = false;
20
21 constructor(private videoService: VideoService) {}
22
23 displayRemoveIcon() {
24 return this.hovering && this.video.isRemovableBy(this.user);
25 }
26
27 onBlur() {
28 this.hovering = false;
29 }
30
31 onHover() {
32 this.hovering = true;
33 }
34
35 removeVideo(id: string) {
36 if (confirm('Do you really want to remove this video?')) {
37 this.videoService.removeVideo(id).subscribe(
38 status => this.removed.emit(true),
39 error => alert(error.text)
40 );
41 }
42 }
43 }