diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-13 10:24:28 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-13 10:24:28 +0100 |
commit | 066e94c5382a761180c7d82fa24b31b66dbeaca4 (patch) | |
tree | 36037c2c5aaa6c86c2299ceafe6ec35dd1abbd13 /client/src/app/videos | |
parent | 66c3b7744c6c7a91b9538eb5a6e0ae07e0a5a6af (diff) | |
download | PeerTube-066e94c5382a761180c7d82fa24b31b66dbeaca4.tar.gz PeerTube-066e94c5382a761180c7d82fa24b31b66dbeaca4.tar.zst PeerTube-066e94c5382a761180c7d82fa24b31b66dbeaca4.zip |
Add "local" videos in menu
Diffstat (limited to 'client/src/app/videos')
-rw-r--r-- | client/src/app/videos/video-list/video-local.component.ts | 37 | ||||
-rw-r--r-- | client/src/app/videos/videos-routing.module.ts | 10 | ||||
-rw-r--r-- | client/src/app/videos/videos.module.ts | 2 |
3 files changed, 49 insertions, 0 deletions
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts new file mode 100644 index 000000000..8cac2c12c --- /dev/null +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -0,0 +1,37 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { ActivatedRoute, Router } from '@angular/router' | ||
3 | import { immutableAssign } from '@app/shared/misc/utils' | ||
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { AuthService } from '../../core/auth' | ||
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
7 | import { SortField } from '../../shared/video/sort-field.type' | ||
8 | import { VideoService } from '../../shared/video/video.service' | ||
9 | |||
10 | @Component({ | ||
11 | selector: 'my-videos-local', | ||
12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | ||
13 | templateUrl: '../../shared/video/abstract-video-list.html' | ||
14 | }) | ||
15 | export class VideoLocalComponent extends AbstractVideoList implements OnInit { | ||
16 | titlePage = 'Local videos' | ||
17 | currentRoute = '/videos/local' | ||
18 | sort = '-createdAt' as SortField | ||
19 | |||
20 | constructor (protected router: Router, | ||
21 | protected route: ActivatedRoute, | ||
22 | protected notificationsService: NotificationsService, | ||
23 | protected authService: AuthService, | ||
24 | private videoService: VideoService) { | ||
25 | super() | ||
26 | } | ||
27 | |||
28 | ngOnInit () { | ||
29 | super.ngOnInit() | ||
30 | } | ||
31 | |||
32 | getVideosObservable (page: number) { | ||
33 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | ||
34 | |||
35 | return this.videoService.getVideos(newPagination, this.sort, 'local') | ||
36 | } | ||
37 | } | ||
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts index 29ec5fd4f..561137b70 100644 --- a/client/src/app/videos/videos-routing.module.ts +++ b/client/src/app/videos/videos-routing.module.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' | ||
3 | import { MetaGuard } from '@ngx-meta/core' | 4 | import { MetaGuard } from '@ngx-meta/core' |
4 | import { VideoSearchComponent } from './video-list' | 5 | import { VideoSearchComponent } from './video-list' |
5 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 6 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
@@ -36,6 +37,15 @@ const videosRoutes: Routes = [ | |||
36 | } | 37 | } |
37 | }, | 38 | }, |
38 | { | 39 | { |
40 | path: 'local', | ||
41 | component: VideoLocalComponent, | ||
42 | data: { | ||
43 | meta: { | ||
44 | title: 'Local videos' | ||
45 | } | ||
46 | } | ||
47 | }, | ||
48 | { | ||
39 | path: 'search', | 49 | path: 'search', |
40 | component: VideoSearchComponent, | 50 | component: VideoSearchComponent, |
41 | data: { | 51 | data: { |
diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts index 4b14d1da8..7c3d457b3 100644 --- a/client/src/app/videos/videos.module.ts +++ b/client/src/app/videos/videos.module.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' | ||
2 | import { SharedModule } from '../shared' | 3 | import { SharedModule } from '../shared' |
3 | import { VideoSearchComponent } from './video-list' | 4 | import { VideoSearchComponent } from './video-list' |
4 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 5 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
@@ -17,6 +18,7 @@ import { VideosComponent } from './videos.component' | |||
17 | 18 | ||
18 | VideoTrendingComponent, | 19 | VideoTrendingComponent, |
19 | VideoRecentlyAddedComponent, | 20 | VideoRecentlyAddedComponent, |
21 | VideoLocalComponent, | ||
20 | VideoSearchComponent | 22 | VideoSearchComponent |
21 | ], | 23 | ], |
22 | 24 | ||