ContainerMarkupData,
EmbedMarkupData,
PlaylistMiniatureMarkupData,
+ VideoFilter,
VideoMiniatureMarkupData,
VideosListMarkupData
} from '@shared/models'
return component
}
- private videoMiniatureBuilder (el: HTMLElement) {
- const data = el.dataset as VideoMiniatureMarkupData
- const component = this.dynamicElementService.createElement(VideoMiniatureMarkupComponent)
-
- this.dynamicElementService.setModel(component, { uuid: data.uuid })
-
- return component
- }
-
private playlistMiniatureBuilder (el: HTMLElement) {
const data = el.dataset as PlaylistMiniatureMarkupData
const component = this.dynamicElementService.createElement(PlaylistMiniatureMarkupComponent)
return component
}
+ private videoMiniatureBuilder (el: HTMLElement) {
+ const data = el.dataset as VideoMiniatureMarkupData
+ const component = this.dynamicElementService.createElement(VideoMiniatureMarkupComponent)
+
+ const model = {
+ uuid: data.uuid,
+ onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false
+ }
+
+ this.dynamicElementService.setModel(component, model)
+
+ return component
+ }
+
private videosListBuilder (el: HTMLElement) {
const data = el.dataset as VideosListMarkupData
const component = this.dynamicElementService.createElement(VideosListMarkupComponent)
const model = {
- sort: data.sort,
- categoryOneOf: this.buildArrayNumber(data.categoryOneOf),
- languageOneOf: this.buildArrayString(data.languageOneOf),
+ onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false,
+ sort: data.sort || '-publishedAt',
+ categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [],
+ languageOneOf: this.buildArrayString(data.languageOneOf) ?? [],
+ filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined,
count: this.buildNumber(data.count) || 10
}
})
export class VideoMiniatureMarkupComponent implements OnInit {
@Input() uuid: string
+ @Input() onlyDisplayTitle: boolean
video: Video
}
ngOnInit () {
+ if (this.onlyDisplayTitle) {
+ for (const key of Object.keys(this.displayOptions)) {
+ this.displayOptions[key] = false
+ }
+ }
+
this.videoService.getVideo({ videoId: this.uuid })
.subscribe(video => this.video = video)
}
import { Component, Input, OnInit } from '@angular/core'
import { AuthService } from '@app/core'
-import { VideoSortField } from '@shared/models'
+import { VideoFilter, VideoSortField } from '@shared/models'
import { Video, VideoService } from '../../shared-main'
import { MiniatureDisplayOptions } from '../../shared-video-miniature'
styleUrls: [ 'videos-list-markup.component.scss' ]
})
export class VideosListMarkupComponent implements OnInit {
- @Input() sort = '-publishedAt'
+ @Input() sort: string
@Input() categoryOneOf: number[]
@Input() languageOneOf: string[]
- @Input() count = 10
+ @Input() count: number
+ @Input() onlyDisplayTitle: boolean
+ @Input() filter: VideoFilter
videos: Video[]
displayOptions: MiniatureDisplayOptions = {
- date: true,
+ date: false,
views: true,
by: true,
avatar: false,
}
ngOnInit () {
+ if (this.onlyDisplayTitle) {
+ for (const key of Object.keys(this.displayOptions)) {
+ this.displayOptions[key] = false
+ }
+ }
+
const options = {
videoPagination: {
currentPage: 1,
},
categoryOneOf: this.categoryOneOf,
languageOneOf: this.languageOneOf,
+ filter: this.filter,
sort: this.sort as VideoSortField
}
export type VideoMiniatureMarkupData = {
// Video uuid
uuid: string
+
+ onlyDisplayTitle?: string // boolean
}
export type PlaylistMiniatureMarkupData = {
}
export type VideosListMarkupData = {
- sort: string
- categoryOneOf: string // coma separated values
- languageOneOf: string // coma separated values
- count: string
+ onlyDisplayTitle?: string // boolean
+
+ sort?: string
+ count?: string
+
+ categoryOneOf?: string // coma separated values
+ languageOneOf?: string // coma separated values
+
+ onlyLocal?: string // boolean
}
export type ButtonMarkupData = {
theme: 'primary' | 'secondary'
href: string
label: string
- blankTarget?: string
+ blankTarget?: string // boolean
}
export type ContainerMarkupData = {