diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-25 16:56:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-25 16:56:13 +0200 |
commit | 170726f523ff48f89da45473fc53ca54784f43dd (patch) | |
tree | f9f783ebdfc934c6831396c2bf33f658d6640583 /client/src/app/+video-channels/video-channel-videos | |
parent | cc918ac3f45e32f031cce7b6e0473e5c2c34b8ae (diff) | |
download | PeerTube-170726f523ff48f89da45473fc53ca54784f43dd.tar.gz PeerTube-170726f523ff48f89da45473fc53ca54784f43dd.tar.zst PeerTube-170726f523ff48f89da45473fc53ca54784f43dd.zip |
Implement video channel views
Diffstat (limited to 'client/src/app/+video-channels/video-channel-videos')
-rw-r--r-- | client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.scss | 3 | ||||
-rw-r--r-- | client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts | 71 |
2 files changed, 74 insertions, 0 deletions
diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.scss b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.scss new file mode 100644 index 000000000..2ba85c031 --- /dev/null +++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.scss | |||
@@ -0,0 +1,3 @@ | |||
1 | .title-page-single { | ||
2 | margin-top: 0; | ||
3 | } \ No newline at end of file | ||
diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts new file mode 100644 index 000000000..3cda630d3 --- /dev/null +++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts | |||
@@ -0,0 +1,71 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | ||
2 | import { ActivatedRoute, Router } from '@angular/router' | ||
3 | import { Location } from '@angular/common' | ||
4 | import { immutableAssign } from '@app/shared/misc/utils' | ||
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import 'rxjs/add/observable/from' | ||
7 | import 'rxjs/add/operator/concatAll' | ||
8 | import { AuthService } from '../../core/auth' | ||
9 | import { ConfirmService } from '../../core/confirm' | ||
10 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | ||
11 | import { VideoService } from '../../shared/video/video.service' | ||
12 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | ||
13 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | ||
14 | |||
15 | @Component({ | ||
16 | selector: 'my-video-channel-videos', | ||
17 | templateUrl: '../../shared/video/abstract-video-list.html', | ||
18 | styleUrls: [ | ||
19 | '../../shared/video/abstract-video-list.scss', | ||
20 | './video-channel-videos.component.scss' | ||
21 | ] | ||
22 | }) | ||
23 | export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy { | ||
24 | titlePage = 'Published videos' | ||
25 | marginContent = false // Disable margin | ||
26 | currentRoute = '/video-channel/videos' | ||
27 | loadOnInit = false | ||
28 | |||
29 | private videoChannel: VideoChannel | ||
30 | |||
31 | constructor ( | ||
32 | protected router: Router, | ||
33 | protected route: ActivatedRoute, | ||
34 | protected authService: AuthService, | ||
35 | protected notificationsService: NotificationsService, | ||
36 | protected confirmService: ConfirmService, | ||
37 | protected location: Location, | ||
38 | private videoChannelService: VideoChannelService, | ||
39 | private videoService: VideoService | ||
40 | ) { | ||
41 | super() | ||
42 | } | ||
43 | |||
44 | ngOnInit () { | ||
45 | super.ngOnInit() | ||
46 | |||
47 | // Parent get the video channel for us | ||
48 | this.videoChannelService.videoChannelLoaded | ||
49 | .subscribe(videoChannel => { | ||
50 | this.videoChannel = videoChannel | ||
51 | this.currentRoute = '/video-channel/' + this.videoChannel.uuid + '/videos' | ||
52 | |||
53 | this.loadMoreVideos(this.pagination.currentPage) | ||
54 | this.generateSyndicationList() | ||
55 | }) | ||
56 | } | ||
57 | |||
58 | ngOnDestroy () { | ||
59 | super.ngOnDestroy() | ||
60 | } | ||
61 | |||
62 | getVideosObservable (page: number) { | ||
63 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | ||
64 | |||
65 | return this.videoService.getVideoChannelVideos(this.videoChannel, newPagination, this.sort) | ||
66 | } | ||
67 | |||
68 | generateSyndicationList () { | ||
69 | this.syndicationItems = this.videoService.getVideoChannelFeedUrls(this.videoChannel.id) | ||
70 | } | ||
71 | } | ||