diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-14 13:50:19 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-14 13:50:19 +0100 |
commit | dc8bc31be517a53e8fbe7100cfe45cd73f596de0 (patch) | |
tree | c0b0d6641dd352dafff93b8fd33ddb262b59aa47 /client/angular/videos/components/list | |
parent | bd324a669218f9ed302f7f54b36ee535d25c9733 (diff) | |
download | PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.gz PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.zst PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.zip |
Angular application :first draft
Diffstat (limited to 'client/angular/videos/components/list')
3 files changed, 84 insertions, 0 deletions
diff --git a/client/angular/videos/components/list/videos-list.component.html b/client/angular/videos/components/list/videos-list.component.html new file mode 100644 index 000000000..7ecdacee4 --- /dev/null +++ b/client/angular/videos/components/list/videos-list.component.html | |||
@@ -0,0 +1,11 @@ | |||
1 | <div *ngFor="#video of videos" class="video"> | ||
2 | <div> | ||
3 | <a [routerLink]="['VideosWatch', { id: video._id }]" class="video_name">{{ video.name }}</a> | ||
4 | <span class="video_pod_url">{{ video.podUrl }}</span> | ||
5 | <span *ngIf="video.namePath !== null" (click)="removeVideo(video._id)" class="video_remove glyphicon glyphicon-remove"></span> | ||
6 | </div> | ||
7 | |||
8 | <div class="video_description"> | ||
9 | {{ video.description }} | ||
10 | </div> | ||
11 | </div> | ||
diff --git a/client/angular/videos/components/list/videos-list.component.scss b/client/angular/videos/components/list/videos-list.component.scss new file mode 100644 index 000000000..82ddd80e5 --- /dev/null +++ b/client/angular/videos/components/list/videos-list.component.scss | |||
@@ -0,0 +1,34 @@ | |||
1 | .video { | ||
2 | margin-bottom: 10px; | ||
3 | transition: margin 0.5s ease; | ||
4 | |||
5 | &:hover { | ||
6 | margin-left: 5px; | ||
7 | } | ||
8 | |||
9 | a.video_name { | ||
10 | color: #333333; | ||
11 | margin-right: 5px; | ||
12 | } | ||
13 | |||
14 | .video_pod_url { | ||
15 | font-size: small; | ||
16 | color: rgba(0, 0, 0, 0.5); | ||
17 | } | ||
18 | |||
19 | .video_description { | ||
20 | font-size: small; | ||
21 | font-style: italic; | ||
22 | margin-left: 7px; | ||
23 | } | ||
24 | |||
25 | .video_remove { | ||
26 | margin: 5px; | ||
27 | cursor: pointer; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | .loading { | ||
32 | display: inline-block; | ||
33 | margin-top: 100px; | ||
34 | } | ||
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts new file mode 100644 index 000000000..e5af87448 --- /dev/null +++ b/client/angular/videos/components/list/videos-list.component.ts | |||
@@ -0,0 +1,39 @@ | |||
1 | import {Component, OnInit} from 'angular2/core'; | ||
2 | import {ROUTER_DIRECTIVES} from 'angular2/router'; | ||
3 | |||
4 | import {VideosService} from '../../services/videos.service'; | ||
5 | import {Video} from '../../models/video'; | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'my-videos-list', | ||
9 | styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ], | ||
10 | templateUrl: 'app/angular/videos/components/list/videos-list.component.html', | ||
11 | directives: [ ROUTER_DIRECTIVES ] | ||
12 | }) | ||
13 | |||
14 | export class VideosListComponent implements OnInit { | ||
15 | videos: Video[]; | ||
16 | |||
17 | constructor( | ||
18 | private _videosService: VideosService | ||
19 | ) { } | ||
20 | |||
21 | ngOnInit() { | ||
22 | this.getVideos(); | ||
23 | } | ||
24 | |||
25 | getVideos() { | ||
26 | this._videosService.getVideos().subscribe( | ||
27 | videos => this.videos = videos, | ||
28 | error => alert(error) | ||
29 | ); | ||
30 | } | ||
31 | |||
32 | removeVideo(id: string) { | ||
33 | this._videosService.removeVideo(id).subscribe( | ||
34 | status => this.getVideos(), | ||
35 | error => alert(error) | ||
36 | ) | ||
37 | } | ||
38 | |||
39 | } | ||