From 170726f523ff48f89da45473fc53ca54784f43dd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 16:56:13 +0200 Subject: Implement video channel views --- client/src/app/+video-channels/index.ts | 3 + .../video-channel-about.component.html | 12 ++++ .../video-channel-about.component.scss | 8 +++ .../video-channel-about.component.ts | 32 ++++++++++ .../video-channel-videos.component.scss | 3 + .../video-channel-videos.component.ts | 71 ++++++++++++++++++++++ .../video-channels-routing.module.ts | 45 ++++++++++++++ .../+video-channels/video-channels.component.html | 23 +++++++ .../+video-channels/video-channels.component.scss | 6 ++ .../+video-channels/video-channels.component.ts | 24 ++++++++ .../app/+video-channels/video-channels.module.ts | 26 ++++++++ 11 files changed, 253 insertions(+) create mode 100644 client/src/app/+video-channels/index.ts create mode 100644 client/src/app/+video-channels/video-channel-about/video-channel-about.component.html create mode 100644 client/src/app/+video-channels/video-channel-about/video-channel-about.component.scss create mode 100644 client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts create mode 100644 client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.scss create mode 100644 client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts create mode 100644 client/src/app/+video-channels/video-channels-routing.module.ts create mode 100644 client/src/app/+video-channels/video-channels.component.html create mode 100644 client/src/app/+video-channels/video-channels.component.scss create mode 100644 client/src/app/+video-channels/video-channels.component.ts create mode 100644 client/src/app/+video-channels/video-channels.module.ts (limited to 'client/src/app/+video-channels') diff --git a/client/src/app/+video-channels/index.ts b/client/src/app/+video-channels/index.ts new file mode 100644 index 000000000..6683d1b12 --- /dev/null +++ b/client/src/app/+video-channels/index.ts @@ -0,0 +1,3 @@ +export * from './video-channels-routing.module' +export * from './video-channels.component' +export * from './video-channels.module' diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html new file mode 100644 index 000000000..65ad6f541 --- /dev/null +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html @@ -0,0 +1,12 @@ +
+
+
Description
+
{{ getVideoChannelDescription() }}
+
+ +
+
Stats
+ +
Created {{ videoChannel.createdAt | date }}
+
+
\ No newline at end of file diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.scss b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.scss new file mode 100644 index 000000000..b1be7d4ed --- /dev/null +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.scss @@ -0,0 +1,8 @@ +@import '_variables'; +@import '_mixins'; + +.small-title { + @include in-content-small-title; + + margin-bottom: 20px; +} diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts new file mode 100644 index 000000000..5d435708e --- /dev/null +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts @@ -0,0 +1,32 @@ +import { Component, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import 'rxjs/add/observable/from' +import 'rxjs/add/operator/concatAll' +import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' +import { VideoChannel } from '@app/shared/video-channel/video-channel.model' + +@Component({ + selector: 'my-video-channel-about', + templateUrl: './video-channel-about.component.html', + styleUrls: [ './video-channel-about.component.scss' ] +}) +export class VideoChannelAboutComponent implements OnInit { + videoChannel: VideoChannel + + constructor ( + protected route: ActivatedRoute, + private videoChannelService: VideoChannelService + ) { } + + ngOnInit () { + // Parent get the video channel for us + this.videoChannelService.videoChannelLoaded + .subscribe(videoChannel => this.videoChannel = videoChannel) + } + + getVideoChannelDescription () { + if (this.videoChannel.description) return this.videoChannel.description + + return 'No description' + } +} 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 @@ +.title-page-single { + margin-top: 0; +} \ 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 @@ +import { Component, OnDestroy, OnInit } from '@angular/core' +import { ActivatedRoute, Router } from '@angular/router' +import { Location } from '@angular/common' +import { immutableAssign } from '@app/shared/misc/utils' +import { NotificationsService } from 'angular2-notifications' +import 'rxjs/add/observable/from' +import 'rxjs/add/operator/concatAll' +import { AuthService } from '../../core/auth' +import { ConfirmService } from '../../core/confirm' +import { AbstractVideoList } from '../../shared/video/abstract-video-list' +import { VideoService } from '../../shared/video/video.service' +import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' +import { VideoChannel } from '@app/shared/video-channel/video-channel.model' + +@Component({ + selector: 'my-video-channel-videos', + templateUrl: '../../shared/video/abstract-video-list.html', + styleUrls: [ + '../../shared/video/abstract-video-list.scss', + './video-channel-videos.component.scss' + ] +}) +export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy { + titlePage = 'Published videos' + marginContent = false // Disable margin + currentRoute = '/video-channel/videos' + loadOnInit = false + + private videoChannel: VideoChannel + + constructor ( + protected router: Router, + protected route: ActivatedRoute, + protected authService: AuthService, + protected notificationsService: NotificationsService, + protected confirmService: ConfirmService, + protected location: Location, + private videoChannelService: VideoChannelService, + private videoService: VideoService + ) { + super() + } + + ngOnInit () { + super.ngOnInit() + + // Parent get the video channel for us + this.videoChannelService.videoChannelLoaded + .subscribe(videoChannel => { + this.videoChannel = videoChannel + this.currentRoute = '/video-channel/' + this.videoChannel.uuid + '/videos' + + this.loadMoreVideos(this.pagination.currentPage) + this.generateSyndicationList() + }) + } + + ngOnDestroy () { + super.ngOnDestroy() + } + + getVideosObservable (page: number) { + const newPagination = immutableAssign(this.pagination, { currentPage: page }) + + return this.videoService.getVideoChannelVideos(this.videoChannel, newPagination, this.sort) + } + + generateSyndicationList () { + this.syndicationItems = this.videoService.getVideoChannelFeedUrls(this.videoChannel.id) + } +} diff --git a/client/src/app/+video-channels/video-channels-routing.module.ts b/client/src/app/+video-channels/video-channels-routing.module.ts new file mode 100644 index 000000000..935578d2a --- /dev/null +++ b/client/src/app/+video-channels/video-channels-routing.module.ts @@ -0,0 +1,45 @@ +import { NgModule } from '@angular/core' +import { RouterModule, Routes } from '@angular/router' +import { MetaGuard } from '@ngx-meta/core' +import { VideoChannelsComponent } from './video-channels.component' +import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' +import { VideoChannelAboutComponent } from './video-channel-about/video-channel-about.component' + +const videoChannelsRoutes: Routes = [ + { + path: ':videoChannelId', + component: VideoChannelsComponent, + canActivateChild: [ MetaGuard ], + children: [ + { + path: '', + redirectTo: 'videos', + pathMatch: 'full' + }, + { + path: 'videos', + component: VideoChannelVideosComponent, + data: { + meta: { + title: 'Video channel videos' + } + } + }, + { + path: 'about', + component: VideoChannelAboutComponent, + data: { + meta: { + title: 'About video channel' + } + } + } + ] + } +] + +@NgModule({ + imports: [ RouterModule.forChild(videoChannelsRoutes) ], + exports: [ RouterModule ] +}) +export class VideoChannelsRoutingModule {} diff --git a/client/src/app/+video-channels/video-channels.component.html b/client/src/app/+video-channels/video-channels.component.html new file mode 100644 index 000000000..098e1eed4 --- /dev/null +++ b/client/src/app/+video-channels/video-channels.component.html @@ -0,0 +1,23 @@ +
+ + +
+ +
+
diff --git a/client/src/app/+video-channels/video-channels.component.scss b/client/src/app/+video-channels/video-channels.component.scss new file mode 100644 index 000000000..909b65bc7 --- /dev/null +++ b/client/src/app/+video-channels/video-channels.component.scss @@ -0,0 +1,6 @@ +@import '_variables'; +@import '_mixins'; + +.sub-menu { + @include sub-menu-with-actor; +} \ No newline at end of file diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts new file mode 100644 index 000000000..5eca64fb5 --- /dev/null +++ b/client/src/app/+video-channels/video-channels.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' + +@Component({ + templateUrl: './video-channels.component.html', + styleUrls: [ './video-channels.component.scss' ] +}) +export class VideoChannelsComponent implements OnInit { + videoChannel: VideoChannel + + constructor ( + private route: ActivatedRoute, + private videoChannelService: VideoChannelService + ) {} + + ngOnInit () { + const videoChannelId = this.route.snapshot.params['videoChannelId'] + + this.videoChannelService.getVideoChannel(videoChannelId) + .subscribe(videoChannel => this.videoChannel = videoChannel) + } +} diff --git a/client/src/app/+video-channels/video-channels.module.ts b/client/src/app/+video-channels/video-channels.module.ts new file mode 100644 index 000000000..a09ea6f11 --- /dev/null +++ b/client/src/app/+video-channels/video-channels.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core' +import { SharedModule } from '../shared' +import { VideoChannelsRoutingModule } from './video-channels-routing.module' +import { VideoChannelsComponent } from './video-channels.component' +import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' +import { VideoChannelAboutComponent } from './video-channel-about/video-channel-about.component' + +@NgModule({ + imports: [ + VideoChannelsRoutingModule, + SharedModule + ], + + declarations: [ + VideoChannelsComponent, + VideoChannelVideosComponent, + VideoChannelAboutComponent + ], + + exports: [ + VideoChannelsComponent + ], + + providers: [] +}) +export class VideoChannelsModule { } -- cgit v1.2.3