diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
commit | 4a6995be18b15de1834a39c8921a0e4109671bb6 (patch) | |
tree | b659661cea33687fcc6bd8fc2251cb7a15ab9f9d /client/src/app/videos/video-list/video-miniature.component.ts | |
parent | 468892541175f9662f8b1b977e819dc1a496f282 (diff) | |
download | PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.gz PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.zst PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.zip |
First draft to use webpack instead of systemjs
Diffstat (limited to 'client/src/app/videos/video-list/video-miniature.component.ts')
-rw-r--r-- | client/src/app/videos/video-list/video-miniature.component.ts | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts new file mode 100644 index 000000000..639339b44 --- /dev/null +++ b/client/src/app/videos/video-list/video-miniature.component.ts | |||
@@ -0,0 +1,46 @@ | |||
1 | import { DatePipe } from '@angular/common'; | ||
2 | import { Component, Input, Output, EventEmitter } from '@angular/core'; | ||
3 | import { ROUTER_DIRECTIVES } from '@angular/router-deprecated'; | ||
4 | |||
5 | import { Video, VideoService } from '../shared'; | ||
6 | import { User } from '../../shared'; | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-video-miniature', | ||
10 | styles: [ require('./video-miniature.component.scss') ], | ||
11 | template: require('./video-miniature.component.html'), | ||
12 | directives: [ ROUTER_DIRECTIVES ], | ||
13 | pipes: [ DatePipe ] | ||
14 | }) | ||
15 | |||
16 | export class VideoMiniatureComponent { | ||
17 | @Output() removed = new EventEmitter<any>(); | ||
18 | |||
19 | @Input() user: User; | ||
20 | @Input() video: Video; | ||
21 | |||
22 | hovering = false; | ||
23 | |||
24 | constructor(private videoService: VideoService) {} | ||
25 | |||
26 | displayRemoveIcon() { | ||
27 | return this.hovering && this.video.isRemovableBy(this.user); | ||
28 | } | ||
29 | |||
30 | onBlur() { | ||
31 | this.hovering = false; | ||
32 | } | ||
33 | |||
34 | onHover() { | ||
35 | this.hovering = true; | ||
36 | } | ||
37 | |||
38 | removeVideo(id: string) { | ||
39 | if (confirm('Do you really want to remove this video?')) { | ||
40 | this.videoService.removeVideo(id).subscribe( | ||
41 | status => this.removed.emit(true), | ||
42 | error => alert(error) | ||
43 | ); | ||
44 | } | ||
45 | } | ||
46 | } | ||