diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-26 20:40:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-26 20:40:03 +0200 |
commit | 157cb9c9713e08ff70078660a32dd77ecb87eabc (patch) | |
tree | 4a9066f820be014fcbddf582fd6b92bdb006dccf /client/angular/videos/components/list | |
parent | a99593ed9f3244e75f7db793ba6716754d664573 (diff) | |
download | PeerTube-157cb9c9713e08ff70078660a32dd77ecb87eabc.tar.gz PeerTube-157cb9c9713e08ff70078660a32dd77ecb87eabc.tar.zst PeerTube-157cb9c9713e08ff70078660a32dd77ecb87eabc.zip |
Add a loader animation when loading the videos list
Diffstat (limited to 'client/angular/videos/components/list')
3 files changed, 28 insertions, 15 deletions
diff --git a/client/angular/videos/components/list/videos-list.component.html b/client/angular/videos/components/list/videos-list.component.html index 3e30b39b0..edbbaf3ae 100644 --- a/client/angular/videos/components/list/videos-list.component.html +++ b/client/angular/videos/components/list/videos-list.component.html | |||
@@ -4,7 +4,9 @@ | |||
4 | </div> | 4 | </div> |
5 | 5 | ||
6 | <div class="videos-miniatures"> | 6 | <div class="videos-miniatures"> |
7 | <div *ngIf="videos.length === 0">There is no video.</div> | 7 | <my-loader [loading]="loading"></my-loader> |
8 | |||
9 | <div class="col-md-12 no-video" *ngIf="!loading && videos.length === 0">There is no video.</div> | ||
8 | 10 | ||
9 | <my-video-miniature *ngFor="let video of videos" [video]="video" [user]="user" (removed)="onRemoved(video)"> | 11 | <my-video-miniature *ngFor="let video of videos" [video]="video" [user]="user" (removed)="onRemoved(video)"> |
10 | </my-video-miniature> | 12 | </my-video-miniature> |
diff --git a/client/angular/videos/components/list/videos-list.component.scss b/client/angular/videos/components/list/videos-list.component.scss index 2abc47b1b..9441d80c3 100644 --- a/client/angular/videos/components/list/videos-list.component.scss +++ b/client/angular/videos/components/list/videos-list.component.scss | |||
@@ -1,16 +1,3 @@ | |||
1 | .videos-miniatures { | ||
2 | min-height: 600px; | ||
3 | } | ||
4 | |||
5 | my-videos-miniature { | ||
6 | display: inline-block; | ||
7 | } | ||
8 | |||
9 | pagination { | ||
10 | display: block; | ||
11 | text-align: center; | ||
12 | } | ||
13 | |||
14 | .videos-info { | 1 | .videos-info { |
15 | 2 | ||
16 | padding-bottom: 20px; | 3 | padding-bottom: 20px; |
@@ -30,3 +17,21 @@ pagination { | |||
30 | padding-left: 0; | 17 | padding-left: 0; |
31 | } | 18 | } |
32 | } | 19 | } |
20 | |||
21 | .videos-miniatures { | ||
22 | min-height: 600px; | ||
23 | |||
24 | my-videos-miniature { | ||
25 | display: inline-block; | ||
26 | } | ||
27 | |||
28 | .no-video { | ||
29 | margin-top: 50px; | ||
30 | text-align: center; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | pagination { | ||
35 | display: block; | ||
36 | text-align: center; | ||
37 | } | ||
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts index 94b064e16..56230e331 100644 --- a/client/angular/videos/components/list/videos-list.component.ts +++ b/client/angular/videos/components/list/videos-list.component.ts | |||
@@ -12,12 +12,13 @@ import { VideoMiniatureComponent } from './video-miniature.component'; | |||
12 | import { Search, SearchField } from '../../../app/search'; | 12 | import { Search, SearchField } from '../../../app/search'; |
13 | import { VideoSortComponent } from './video-sort.component'; | 13 | import { VideoSortComponent } from './video-sort.component'; |
14 | import { SortField } from './sort'; | 14 | import { SortField } from './sort'; |
15 | import { LoaderComponent } from '../../loader.component'; | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-videos-list', | 18 | selector: 'my-videos-list', |
18 | styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ], | 19 | styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ], |
19 | templateUrl: 'app/angular/videos/components/list/videos-list.component.html', | 20 | templateUrl: 'app/angular/videos/components/list/videos-list.component.html', |
20 | directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent ] | 21 | directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ] |
21 | }) | 22 | }) |
22 | 23 | ||
23 | export class VideosListComponent implements OnInit { | 24 | export class VideosListComponent implements OnInit { |
@@ -29,6 +30,7 @@ export class VideosListComponent implements OnInit { | |||
29 | total: 0 | 30 | total: 0 |
30 | }; | 31 | }; |
31 | sort: SortField; | 32 | sort: SortField; |
33 | loading: boolean = false; | ||
32 | 34 | ||
33 | private search: Search; | 35 | private search: Search; |
34 | 36 | ||
@@ -55,6 +57,9 @@ export class VideosListComponent implements OnInit { | |||
55 | } | 57 | } |
56 | 58 | ||
57 | getVideos() { | 59 | getVideos() { |
60 | this.loading = true; | ||
61 | this.videos = []; | ||
62 | |||
58 | let observable = null; | 63 | let observable = null; |
59 | 64 | ||
60 | if (this.search.value !== null) { | 65 | if (this.search.value !== null) { |
@@ -67,6 +72,7 @@ export class VideosListComponent implements OnInit { | |||
67 | ({ videos, totalVideos }) => { | 72 | ({ videos, totalVideos }) => { |
68 | this.videos = videos; | 73 | this.videos = videos; |
69 | this.pagination.total = totalVideos; | 74 | this.pagination.total = totalVideos; |
75 | this.loading = false; | ||
70 | }, | 76 | }, |
71 | error => alert(error) | 77 | error => alert(error) |
72 | ); | 78 | ); |