Merge branch 'release/v1.3.0' into develop

pull/1830/head
Chocobozzz 2019-05-21 11:21:56 +02:00
commit 432ebe8bdd
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
7 changed files with 27 additions and 20 deletions

View File

@ -1,4 +1,5 @@
<my-videos-selection <my-videos-selection
[pagination]="pagination"
[(selection)]="selection" [(selection)]="selection"
[(videosModel)]="videos" [(videosModel)]="videos"
[miniatureDisplayOptions]="miniatureDisplayOptions" [miniatureDisplayOptions]="miniatureDisplayOptions"

View File

@ -1,4 +1,5 @@
<my-videos-selection <my-videos-selection
[pagination]="pagination"
[(selection)]="selection" [(selection)]="selection"
[(videosModel)]="videos" [(videosModel)]="videos"
[miniatureDisplayOptions]="miniatureDisplayOptions" [miniatureDisplayOptions]="miniatureDisplayOptions"

View File

@ -1,4 +1,4 @@
<span class="action-button action-button-delete grey-button" [title]="getTitle()" role="button"> <span class="action-button action-button-delete grey-button" [title]="title" role="button">
<my-global-icon iconName="delete"></my-global-icon> <my-global-icon iconName="delete"></my-global-icon>
<span class="button-label" *ngIf="label">{{ label }}</span> <span class="button-label" *ngIf="label">{{ label }}</span>

View File

@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core' import { Component, Input, OnInit } from '@angular/core'
import { I18n } from '@ngx-translate/i18n-polyfill' import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({ @Component({
@ -7,12 +7,14 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
templateUrl: './delete-button.component.html' templateUrl: './delete-button.component.html'
}) })
export class DeleteButtonComponent { export class DeleteButtonComponent implements OnInit {
@Input() label: string @Input() label: string
title: string
constructor (private i18n: I18n) { } constructor (private i18n: I18n) { }
getTitle () { ngOnInit () {
return this.label || this.i18n('Delete') this.title = this.label || this.i18n('Delete')
} }
} }

View File

@ -1,7 +1,8 @@
<div class="no-results" i18n *ngIf="pagination.totalItems === 0">No results.</div> <div class="no-results" i18n *ngIf="pagination.totalItems === 0">No results.</div>
<div myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" class="videos"> <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"> <div class="checkbox-container">
<my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="_selection[video.id]"></my-peertube-checkbox> <my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="_selection[video.id]"></my-peertube-checkbox>
</div> </div>

View File

@ -19,6 +19,7 @@ import { Observable } from 'rxjs'
import { Video } from '@app/shared/video/video.model' import { Video } from '@app/shared/video/video.model'
import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive'
import { VideoSortField } from '@app/shared/video/sort-field.type' import { VideoSortField } from '@app/shared/video/sort-field.type'
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
export type SelectionType = { [ id: number ]: boolean } export type SelectionType = { [ id: number ]: boolean }
@ -28,6 +29,7 @@ export type SelectionType = { [ id: number ]: boolean }
styleUrls: [ './videos-selection.component.scss' ] styleUrls: [ './videos-selection.component.scss' ]
}) })
export class VideosSelectionComponent extends AbstractVideoList implements OnInit, OnDestroy, AfterContentInit { export class VideosSelectionComponent extends AbstractVideoList implements OnInit, OnDestroy, AfterContentInit {
@Input() pagination: ComponentPagination
@Input() titlePage: string @Input() titlePage: string
@Input() miniatureDisplayOptions: MiniatureDisplayOptions @Input() miniatureDisplayOptions: MiniatureDisplayOptions
@Input() getVideosObservableFunction: (page: number, sort?: VideoSortField) => Observable<{ videos: Video[], totalVideos: number }> @Input() getVideosObservableFunction: (page: number, sort?: VideoSortField) => Observable<{ videos: Video[], totalVideos: number }>
@ -52,18 +54,6 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni
super() 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 () { @Input() get selection () {
return this._selection return this._selection
} }
@ -86,6 +76,18 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni
super.ngOnInit() 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 () { ngOnDestroy () {
super.ngOnDestroy() super.ngOnDestroy()
} }

View File

@ -1,6 +1,6 @@
import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { getSortOnModel, SortType, throwIfNotValid } from '../utils' import { getSortOnModel, SortType, throwIfNotValid } from '../utils'
import { VideoModel } from './video' import { VideoModel, ScopeNames as VideoModelScopeNames } from './video'
import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'
import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist'
import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos'
@ -58,7 +58,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
order: getSortOnModel(sort.sortModel, sort.sortValue), order: getSortOnModel(sort.sortModel, sort.sortValue),
include: [ include: [
{ {
model: VideoModel, model: VideoModel.scope(VideoModelScopeNames.WITH_THUMBNAILS),
required: true, required: true,
include: [ include: [
{ {