Skip to content

Commit

Permalink
Fix my videos pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Mar 27, 2018
1 parent 5b5e333 commit a86887a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
)
}

protected buildVideoHeight () {
// In account videos, the video height is fixed
return this.baseVideoHeight
}

private spliceVideosById (id: number) {
for (const key of Object.keys(this.loadedPages)) {
const videos = this.loadedPages[key]
Expand Down
8 changes: 6 additions & 2 deletions client/src/app/shared/video/abstract-video-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
this.videoPages = Object.values(this.loadedPages)
}

protected buildVideoHeight () {
// Same ratios than base width/height
return this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth)
}

private minPageLoaded () {
return Math.min(...Object.keys(this.loadedPages).map(e => parseInt(e, 10)))
}
Expand All @@ -183,8 +188,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {

// Video takes all the width
this.videoWidth = -1
// Same ratios than base width/height
this.videoHeight = this.videosElement.nativeElement.offsetWidth * (this.baseVideoHeight / this.baseVideoWidth)
this.videoHeight = this.buildVideoHeight()
this.pageHeight = this.pagination.itemsPerPage * this.videoHeight
} else {
this.videoWidth = this.baseVideoWidth
Expand Down

0 comments on commit a86887a

Please sign in to comment.