diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-31 11:33:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-31 11:33:49 +0200 |
commit | 8ee25e17b88b970703f4df9e74cb4726bbffd837 (patch) | |
tree | 450d73715c747c82efe6c919ebeda6411c01c5e0 /client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts | |
parent | 15f35256af15b97d2298cc44e76ffcafe73a1c88 (diff) | |
download | PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.gz PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.zst PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.zip |
Add ability to set custom markdown in description
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts new file mode 100644 index 000000000..8d9e223da --- /dev/null +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts | |||
@@ -0,0 +1,60 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | ||
2 | import { AuthService } from '@app/core' | ||
3 | import { VideoSortField } from '@shared/models' | ||
4 | import { Video, VideoService } from '../../shared-main' | ||
5 | import { MiniatureDisplayOptions } from '../../shared-video-miniature' | ||
6 | |||
7 | /* | ||
8 | * Markup component list videos depending on criterias | ||
9 | */ | ||
10 | |||
11 | @Component({ | ||
12 | selector: 'my-videos-list-markup', | ||
13 | templateUrl: 'videos-list-markup.component.html', | ||
14 | styleUrls: [ 'videos-list-markup.component.scss' ] | ||
15 | }) | ||
16 | export class VideosListMarkupComponent implements OnInit { | ||
17 | @Input() title: string | ||
18 | @Input() description: string | ||
19 | @Input() sort = '-publishedAt' | ||
20 | @Input() categoryOneOf: number[] | ||
21 | @Input() languageOneOf: string[] | ||
22 | @Input() count = 10 | ||
23 | |||
24 | videos: Video[] | ||
25 | |||
26 | displayOptions: MiniatureDisplayOptions = { | ||
27 | date: true, | ||
28 | views: true, | ||
29 | by: true, | ||
30 | avatar: false, | ||
31 | privacyLabel: false, | ||
32 | privacyText: false, | ||
33 | state: false, | ||
34 | blacklistInfo: false | ||
35 | } | ||
36 | |||
37 | constructor ( | ||
38 | private auth: AuthService, | ||
39 | private videoService: VideoService | ||
40 | ) { } | ||
41 | |||
42 | getUser () { | ||
43 | return this.auth.getUser() | ||
44 | } | ||
45 | |||
46 | ngOnInit () { | ||
47 | const options = { | ||
48 | videoPagination: { | ||
49 | currentPage: 1, | ||
50 | itemsPerPage: this.count | ||
51 | }, | ||
52 | categoryOneOf: this.categoryOneOf, | ||
53 | languageOneOf: this.languageOneOf, | ||
54 | sort: this.sort as VideoSortField | ||
55 | } | ||
56 | |||
57 | this.videoService.getVideos(options) | ||
58 | .subscribe(({ data }) => this.videos = data) | ||
59 | } | ||
60 | } | ||