From 8c6781e95641fcb3d4a747ba4a37ef8efb1ad1bc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 May 2019 10:54:38 +0200 Subject: Fix pagination in my videos page --- .../shared/buttons/delete-button.component.html | 2 +- .../app/shared/buttons/delete-button.component.ts | 10 +++++---- .../shared/video/videos-selection.component.html | 3 ++- .../app/shared/video/videos-selection.component.ts | 26 ++++++++++++---------- 4 files changed, 23 insertions(+), 18 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/buttons/delete-button.component.html b/client/src/app/shared/buttons/delete-button.component.html index 4d12a84c0..b4acb9d32 100644 --- a/client/src/app/shared/buttons/delete-button.component.html +++ b/client/src/app/shared/buttons/delete-button.component.html @@ -1,4 +1,4 @@ - + {{ label }} diff --git a/client/src/app/shared/buttons/delete-button.component.ts b/client/src/app/shared/buttons/delete-button.component.ts index 8e285d982..39e31900f 100644 --- a/client/src/app/shared/buttons/delete-button.component.ts +++ b/client/src/app/shared/buttons/delete-button.component.ts @@ -1,4 +1,4 @@ -import { Component, Input } from '@angular/core' +import { Component, Input, OnInit } from '@angular/core' import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ @@ -7,12 +7,14 @@ import { I18n } from '@ngx-translate/i18n-polyfill' templateUrl: './delete-button.component.html' }) -export class DeleteButtonComponent { +export class DeleteButtonComponent implements OnInit { @Input() label: string + title: string + constructor (private i18n: I18n) { } - getTitle () { - return this.label || this.i18n('Delete') + ngOnInit () { + this.title = this.label || this.i18n('Delete') } } diff --git a/client/src/app/shared/video/videos-selection.component.html b/client/src/app/shared/video/videos-selection.component.html index 53809b6fd..120c168cd 100644 --- a/client/src/app/shared/video/videos-selection.component.html +++ b/client/src/app/shared/video/videos-selection.component.html @@ -1,7 +1,8 @@
No results.
-
+
+
diff --git a/client/src/app/shared/video/videos-selection.component.ts b/client/src/app/shared/video/videos-selection.component.ts index b6bedafd8..955ebca9f 100644 --- a/client/src/app/shared/video/videos-selection.component.ts +++ b/client/src/app/shared/video/videos-selection.component.ts @@ -19,6 +19,7 @@ import { Observable } from 'rxjs' import { Video } from '@app/shared/video/video.model' import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' import { VideoSortField } from '@app/shared/video/sort-field.type' +import { ComponentPagination } from '@app/shared/rest/component-pagination.model' export type SelectionType = { [ id: number ]: boolean } @@ -28,6 +29,7 @@ export type SelectionType = { [ id: number ]: boolean } styleUrls: [ './videos-selection.component.scss' ] }) export class VideosSelectionComponent extends AbstractVideoList implements OnInit, OnDestroy, AfterContentInit { + @Input() pagination: ComponentPagination @Input() titlePage: string @Input() miniatureDisplayOptions: MiniatureDisplayOptions @Input() getVideosObservableFunction: (page: number, sort?: VideoSortField) => Observable<{ videos: Video[], totalVideos: number }> @@ -52,18 +54,6 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni super() } - ngAfterContentInit () { - { - const t = this.templates.find(t => t.name === 'rowButtons') - if (t) this.rowButtonsTemplate = t.template - } - - { - const t = this.templates.find(t => t.name === 'globalButtons') - if (t) this.globalButtonsTemplate = t.template - } - } - @Input() get selection () { return this._selection } @@ -86,6 +76,18 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni super.ngOnInit() } + ngAfterContentInit () { + { + const t = this.templates.find(t => t.name === 'rowButtons') + if (t) this.rowButtonsTemplate = t.template + } + + { + const t = this.templates.find(t => t.name === 'globalButtons') + if (t) this.globalButtonsTemplate = t.template + } + } + ngOnDestroy () { super.ngOnDestroy() } -- cgit v1.2.3