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