diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-07 17:06:00 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | f0a3988066f72a28bb44520af072f18d91d77dde (patch) | |
tree | dfa3a92102557b567530c5dd014c90866621140a /client/src/app/+my-account | |
parent | 830b4faff15fb9c81d88e8e69fcdf94aad32bef8 (diff) | |
download | PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.gz PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.zst PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.zip |
Add to playlist dropdown
Diffstat (limited to 'client/src/app/+my-account')
9 files changed, 111 insertions, 11 deletions
diff --git a/client/src/app/+my-account/my-account-routing.module.ts b/client/src/app/+my-account/my-account-routing.module.ts index 0193afff7..3f921b13f 100644 --- a/client/src/app/+my-account/my-account-routing.module.ts +++ b/client/src/app/+my-account/my-account-routing.module.ts | |||
@@ -22,6 +22,9 @@ import { | |||
22 | import { | 22 | import { |
23 | MyAccountVideoPlaylistUpdateComponent | 23 | MyAccountVideoPlaylistUpdateComponent |
24 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component' | 24 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component' |
25 | import { | ||
26 | MyAccountVideoPlaylistElementsComponent | ||
27 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' | ||
25 | 28 | ||
26 | const myAccountRoutes: Routes = [ | 29 | const myAccountRoutes: Routes = [ |
27 | { | 30 | { |
@@ -82,6 +85,15 @@ const myAccountRoutes: Routes = [ | |||
82 | } | 85 | } |
83 | }, | 86 | }, |
84 | { | 87 | { |
88 | path: 'video-playlists/:videoPlaylistId', | ||
89 | component: MyAccountVideoPlaylistElementsComponent, | ||
90 | data: { | ||
91 | meta: { | ||
92 | title: 'Playlist elements' | ||
93 | } | ||
94 | } | ||
95 | }, | ||
96 | { | ||
85 | path: 'video-playlists/create', | 97 | path: 'video-playlists/create', |
86 | component: MyAccountVideoPlaylistCreateComponent, | 98 | component: MyAccountVideoPlaylistCreateComponent, |
87 | data: { | 99 | data: { |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.scss b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.scss index 6feb16ab1..0274f47c5 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.scss +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.scss | |||
@@ -4,7 +4,7 @@ | |||
4 | .custom-row { | 4 | .custom-row { |
5 | display: flex; | 5 | display: flex; |
6 | align-items: center; | 6 | align-items: center; |
7 | border-bottom: 1px solid rgba(0, 0, 0, 0.10); | 7 | border-bottom: 1px solid $separator-border-color; |
8 | 8 | ||
9 | &:first-child { | 9 | &:first-child { |
10 | font-size: 16px; | 10 | font-size: 16px; |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html index b76488c78..5d1184218 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html | |||
@@ -60,5 +60,6 @@ | |||
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | </div> | 62 | </div> |
63 | |||
63 | <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid"> | 64 | <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid"> |
64 | </form> | 65 | </form> |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html new file mode 100644 index 000000000..28ea7a857 --- /dev/null +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html | |||
@@ -0,0 +1,16 @@ | |||
1 | <div class="no-results">No videos in this playlist.</div> | ||
2 | |||
3 | <div class="videos" myInfiniteScroller (nearOfBottom)="onNearOfBottom()"> | ||
4 | <div *ngFor="let video of videos" class="video"> | ||
5 | <my-video-thumbnail [video]="video"></my-video-thumbnail> | ||
6 | |||
7 | <div class="video-info"> | ||
8 | <div class="position">{{ video.playlistElement.position }}</div> | ||
9 | |||
10 | <a class="video-info-name" [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name">{{ video.name }}</a> | ||
11 | |||
12 | <a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name">{{ video.name }}</a> | ||
13 | <a tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', video.byAccount ]">{{ video.byAccount }}</a> | ||
14 | </div> | ||
15 | </div> | ||
16 | </div> | ||
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss new file mode 100644 index 000000000..5e6774739 --- /dev/null +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss | |||
@@ -0,0 +1,2 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts new file mode 100644 index 000000000..8b70a9b1a --- /dev/null +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts | |||
@@ -0,0 +1,62 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | ||
2 | import { Notifier } from '@app/core' | ||
3 | import { AuthService } from '../../core/auth' | ||
4 | import { ConfirmService } from '../../core/confirm' | ||
5 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | ||
6 | import { Video } from '@app/shared/video/video.model' | ||
7 | import { Subscription } from 'rxjs' | ||
8 | import { ActivatedRoute } from '@angular/router' | ||
9 | import { VideoService } from '@app/shared/video/video.service' | ||
10 | |||
11 | @Component({ | ||
12 | selector: 'my-account-video-playlist-elements', | ||
13 | templateUrl: './my-account-video-playlist-elements.component.html', | ||
14 | styleUrls: [ './my-account-video-playlist-elements.component.scss' ] | ||
15 | }) | ||
16 | export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestroy { | ||
17 | videos: Video[] = [] | ||
18 | |||
19 | pagination: ComponentPagination = { | ||
20 | currentPage: 1, | ||
21 | itemsPerPage: 10, | ||
22 | totalItems: null | ||
23 | } | ||
24 | |||
25 | private videoPlaylistId: string | number | ||
26 | private paramsSub: Subscription | ||
27 | |||
28 | constructor ( | ||
29 | private authService: AuthService, | ||
30 | private notifier: Notifier, | ||
31 | private confirmService: ConfirmService, | ||
32 | private route: ActivatedRoute, | ||
33 | private videoService: VideoService | ||
34 | ) {} | ||
35 | |||
36 | ngOnInit () { | ||
37 | this.paramsSub = this.route.params.subscribe(routeParams => { | ||
38 | this.videoPlaylistId = routeParams[ 'videoPlaylistId' ] | ||
39 | this.loadElements() | ||
40 | }) | ||
41 | } | ||
42 | |||
43 | ngOnDestroy () { | ||
44 | if (this.paramsSub) this.paramsSub.unsubscribe() | ||
45 | } | ||
46 | |||
47 | onNearOfBottom () { | ||
48 | // Last page | ||
49 | if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return | ||
50 | |||
51 | this.pagination.currentPage += 1 | ||
52 | this.loadElements() | ||
53 | } | ||
54 | |||
55 | private loadElements () { | ||
56 | this.videoService.getPlaylistVideos(this.videoPlaylistId, this.pagination) | ||
57 | .subscribe(({ totalVideos, videos }) => { | ||
58 | this.videos = this.videos.concat(videos) | ||
59 | this.pagination.totalItems = totalVideos | ||
60 | }) | ||
61 | } | ||
62 | } | ||
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html index ab5d9cc5a..7d1bed12a 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html | |||
@@ -5,10 +5,10 @@ | |||
5 | </a> | 5 | </a> |
6 | </div> | 6 | </div> |
7 | 7 | ||
8 | <div class="video-playlists"> | 8 | <div class="video-playlists" myInfiniteScroller (nearOfBottom)="onNearOfBottom()"> |
9 | <div *ngFor="let playlist of videoPlaylists" class="video-playlist"> | 9 | <div *ngFor="let playlist of videoPlaylists" class="video-playlist"> |
10 | <div class="miniature-wrapper"> | 10 | <div class="miniature-wrapper"> |
11 | <my-video-playlist-miniature [playlist]="playlist"></my-video-playlist-miniature> | 11 | <my-video-playlist-miniature [playlist]="playlist" [toManage]="true"></my-video-playlist-miniature> |
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | <div *ngIf="isRegularPlaylist(playlist)" class="video-playlist-buttons"> | 14 | <div *ngIf="isRegularPlaylist(playlist)" class="video-playlist-buttons"> |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index 761ce90e8..e30656b92 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts | |||
@@ -69,17 +69,20 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
69 | return playlist.type.id === VideoPlaylistType.REGULAR | 69 | return playlist.type.id === VideoPlaylistType.REGULAR |
70 | } | 70 | } |
71 | 71 | ||
72 | private loadVideoPlaylists () { | 72 | onNearOfBottom () { |
73 | this.authService.userInformationLoaded | ||
74 | .pipe(flatMap(() => this.videoPlaylistService.listAccountPlaylists(this.user.account))) | ||
75 | .subscribe(res => this.videoPlaylists = res.data) | ||
76 | } | ||
77 | |||
78 | private ofNearOfBottom () { | ||
79 | // Last page | 73 | // Last page |
80 | if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return | 74 | if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return |
81 | 75 | ||
82 | this.pagination.currentPage += 1 | 76 | this.pagination.currentPage += 1 |
83 | this.loadVideoPlaylists() | 77 | this.loadVideoPlaylists() |
84 | } | 78 | } |
79 | |||
80 | private loadVideoPlaylists () { | ||
81 | this.authService.userInformationLoaded | ||
82 | .pipe(flatMap(() => this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'))) | ||
83 | .subscribe(res => { | ||
84 | this.videoPlaylists = this.videoPlaylists.concat(res.data) | ||
85 | this.pagination.totalItems = res.total | ||
86 | }) | ||
87 | } | ||
85 | } | 88 | } |
diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 3dbce2b92..ba8300111 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts | |||
@@ -32,6 +32,9 @@ import { | |||
32 | MyAccountVideoPlaylistUpdateComponent | 32 | MyAccountVideoPlaylistUpdateComponent |
33 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component' | 33 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component' |
34 | import { MyAccountVideoPlaylistsComponent } from '@app/+my-account/my-account-video-playlists/my-account-video-playlists.component' | 34 | import { MyAccountVideoPlaylistsComponent } from '@app/+my-account/my-account-video-playlists/my-account-video-playlists.component' |
35 | import { | ||
36 | MyAccountVideoPlaylistElementsComponent | ||
37 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' | ||
35 | 38 | ||
36 | @NgModule({ | 39 | @NgModule({ |
37 | imports: [ | 40 | imports: [ |
@@ -68,7 +71,8 @@ import { MyAccountVideoPlaylistsComponent } from '@app/+my-account/my-account-vi | |||
68 | 71 | ||
69 | MyAccountVideoPlaylistCreateComponent, | 72 | MyAccountVideoPlaylistCreateComponent, |
70 | MyAccountVideoPlaylistUpdateComponent, | 73 | MyAccountVideoPlaylistUpdateComponent, |
71 | MyAccountVideoPlaylistsComponent | 74 | MyAccountVideoPlaylistsComponent, |
75 | MyAccountVideoPlaylistElementsComponent | ||
72 | ], | 76 | ], |
73 | 77 | ||
74 | exports: [ | 78 | exports: [ |