diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-27 17:37:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-27 17:37:26 +0200 |
commit | a86887a4b8f1055e184508ff284f16e036cdd907 (patch) | |
tree | 7dc6824ec5686ec3b61b95e4b9193875a587725b /client/src/app | |
parent | 5b5e333f068c7bd5fcf519bcd3f687eb46221883 (diff) | |
download | PeerTube-a86887a4b8f1055e184508ff284f16e036cdd907.tar.gz PeerTube-a86887a4b8f1055e184508ff284f16e036cdd907.tar.zst PeerTube-a86887a4b8f1055e184508ff284f16e036cdd907.zip |
Fix my videos pagination
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/account/account-videos/account-videos.component.ts | 5 | ||||
-rw-r--r-- | client/src/app/shared/video/abstract-video-list.ts | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/client/src/app/account/account-videos/account-videos.component.ts b/client/src/app/account/account-videos/account-videos.component.ts index cd0f8e752..4f2f3e242 100644 --- a/client/src/app/account/account-videos/account-videos.component.ts +++ b/client/src/app/account/account-videos/account-videos.component.ts | |||
@@ -106,6 +106,11 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, | |||
106 | ) | 106 | ) |
107 | } | 107 | } |
108 | 108 | ||
109 | protected buildVideoHeight () { | ||
110 | // In account videos, the video height is fixed | ||
111 | return this.baseVideoHeight | ||
112 | } | ||
113 | |||
109 | private spliceVideosById (id: number) { | 114 | private spliceVideosById (id: number) { |
110 | for (const key of Object.keys(this.loadedPages)) { | 115 | for (const key of Object.keys(this.loadedPages)) { |
111 | const videos = this.loadedPages[key] | 116 | const videos = this.loadedPages[key] |
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 90a88544a..021c285c0 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -169,6 +169,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
169 | this.videoPages = Object.values(this.loadedPages) | 169 | this.videoPages = Object.values(this.loadedPages) |
170 | } | 170 | } |
171 | 171 | ||
172 | protected buildVideoHeight () { | ||
173 | // Same ratios than base width/height | ||
174 | return this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth) | ||
175 | } | ||
176 | |||
172 | private minPageLoaded () { | 177 | private minPageLoaded () { |
173 | return Math.min(...Object.keys(this.loadedPages).map(e => parseInt(e, 10))) | 178 | return Math.min(...Object.keys(this.loadedPages).map(e => parseInt(e, 10))) |
174 | } | 179 | } |
@@ -183,8 +188,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
183 | 188 | ||
184 | // Video takes all the width | 189 | // Video takes all the width |
185 | this.videoWidth = -1 | 190 | this.videoWidth = -1 |
186 | // Same ratios than base width/height | 191 | this.videoHeight = this.buildVideoHeight() |
187 | this.videoHeight = this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth) | ||
188 | this.pageHeight = this.pagination.itemsPerPage * this.videoHeight | 192 | this.pageHeight = this.pagination.itemsPerPage * this.videoHeight |
189 | } else { | 193 | } else { |
190 | this.videoWidth = this.baseVideoWidth | 194 | this.videoWidth = this.baseVideoWidth |