X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-list%2Fvideo-miniature.component.ts;h=1cfeacf36192c4e82ca1a7d28b77e06251485b60;hb=d5050d1e097e761685fbaafe6e3d4b8b78d48356;hp=888026ddebb373ff3df74b54b1774667365daf19;hpb=92fb909c9b4a92a00b0d0da7629e6fb003de281b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts index 888026dde..1cfeacf36 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts @@ -1,10 +1,10 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; +import { Component, Input, Output, EventEmitter } from '@angular/core' -import { NotificationsService } from 'angular2-notifications'; +import { NotificationsService } from 'angular2-notifications' -import { ConfirmService, ConfigService } from '../../core'; -import { SortField, Video, VideoService } from '../shared'; -import { User } from '../../shared'; +import { ConfirmService, ConfigService } from '../../core' +import { SortField, Video, VideoService } from '../shared' +import { User } from '../../shared' @Component({ selector: 'my-video-miniature', @@ -13,55 +13,26 @@ import { User } from '../../shared'; }) export class VideoMiniatureComponent { - @Output() removed = new EventEmitter(); + @Input() currentSort: SortField + @Input() user: User + @Input() video: Video - @Input() currentSort: SortField; - @Input() user: User; - @Input() video: Video; - - hovering = false; - - constructor( + constructor ( private notificationsService: NotificationsService, private confirmService: ConfirmService, private configService: ConfigService, private videoService: VideoService ) {} - displayRemoveIcon() { - return this.hovering && this.video.isRemovableBy(this.user); - } - - getVideoName() { - if (this.isVideoNSFWForThisUser()) - return 'NSFW'; - - return this.video.name; - } - - onBlur() { - this.hovering = false; - } - - onHover() { - this.hovering = true; - } - - removeVideo(id: string) { - this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( - res => { - if (res === false) return; - - this.videoService.removeVideo(id).subscribe( - status => this.removed.emit(true), + getVideoName () { + if (this.isVideoNSFWForThisUser()) { + return 'NSFW' + } - error => this.notificationsService.error('Error', error.text) - ); - } - ); + return this.video.name } - isVideoNSFWForThisUser() { - return this.video.isVideoNSFWForUser(this.user); + isVideoNSFWForThisUser () { + return this.video.isVideoNSFWForUser(this.user) } }