]>
Commit | Line | Data |
---|---|---|
734a5ceb | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
170726f5 C |
2 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | |
b1d40cff | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
734a5ceb | 5 | import { Subscription } from 'rxjs' |
1506307f | 6 | import { MarkdownService } from '@app/shared/renderer' |
170726f5 C |
7 | |
8 | @Component({ | |
9 | selector: 'my-video-channel-about', | |
10 | templateUrl: './video-channel-about.component.html', | |
11 | styleUrls: [ './video-channel-about.component.scss' ] | |
12 | }) | |
734a5ceb | 13 | export class VideoChannelAboutComponent implements OnInit, OnDestroy { |
170726f5 | 14 | videoChannel: VideoChannel |
53055a11 C |
15 | descriptionHTML = '' |
16 | supportHTML = '' | |
170726f5 | 17 | |
734a5ceb C |
18 | private videoChannelSub: Subscription |
19 | ||
170726f5 | 20 | constructor ( |
b1d40cff | 21 | private i18n: I18n, |
53055a11 C |
22 | private videoChannelService: VideoChannelService, |
23 | private markdownService: MarkdownService | |
170726f5 C |
24 | ) { } |
25 | ||
26 | ngOnInit () { | |
27 | // Parent get the video channel for us | |
734a5ceb | 28 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded |
53055a11 C |
29 | .subscribe(videoChannel => { |
30 | this.videoChannel = videoChannel | |
31 | ||
32 | this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.videoChannel.description) | |
33 | this.supportHTML = this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support) | |
34 | }) | |
170726f5 C |
35 | } |
36 | ||
734a5ceb C |
37 | ngOnDestroy () { |
38 | if (this.videoChannelSub) this.videoChannelSub.unsubscribe() | |
39 | } | |
40 | ||
170726f5 | 41 | getVideoChannelDescription () { |
53055a11 | 42 | if (this.descriptionHTML) return this.descriptionHTML |
170726f5 | 43 | |
b1d40cff | 44 | return this.i18n('No description') |
170726f5 C |
45 | } |
46 | } |