-import { Component, Input } from '@angular/core'
+import { Component, Input, OnInit } from '@angular/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
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')
}
}
<div class="no-results" i18n *ngIf="pagination.totalItems === 0">No results.</div>
<div myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" class="videos">
- <div class="video" *ngFor="let video of videos; let i = index">
+ <div class="video" *ngFor="let video of videos; let i = index; trackBy: videoById">
+
<div class="checkbox-container">
<my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="_selection[video.id]"></my-peertube-checkbox>
</div>
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 }
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 }>
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
}
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()
}