aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+video-channels
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-18 11:19:10 +0200
committerChocobozzz <me@florianbigard.com>2018-06-18 11:19:10 +0200
commit53055a1124cbc2eaeeeeef21b19b0b46e96f23c5 (patch)
treed761c9928d2568937fad9a2316f7ad2b8b223f07 /client/src/app/+video-channels
parent4d089429fe91ab7793b9b05010acb483d61345de (diff)
downloadPeerTube-53055a1124cbc2eaeeeeef21b19b0b46e96f23c5.tar.gz
PeerTube-53055a1124cbc2eaeeeeef21b19b0b46e96f23c5.tar.zst
PeerTube-53055a1124cbc2eaeeeeef21b19b0b46e96f23c5.zip
Handle markdown in account/video channel pages
Diffstat (limited to 'client/src/app/+video-channels')
-rw-r--r--client/src/app/+video-channels/video-channel-about/video-channel-about.component.html6
-rw-r--r--client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts15
2 files changed, 15 insertions, 6 deletions
diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html
index b7125ff71..9655668d7 100644
--- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html
+++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.html
@@ -2,12 +2,12 @@
2 <div class="description col-md-6 col-sm-12"> 2 <div class="description col-md-6 col-sm-12">
3 <div class="block"> 3 <div class="block">
4 <div i18n class="small-title">Description</div> 4 <div i18n class="small-title">Description</div>
5 <div class="content">{{ getVideoChannelDescription() }}</div> 5 <div class="content" [innerHtml]="getVideoChannelDescription()"></div>
6 </div> 6 </div>
7 7
8 <div class="block" *ngIf="videoChannel.support"> 8 <div class="block" *ngIf="supportHTML">
9 <div i18n class="small-title">Support this channel</div> 9 <div i18n class="small-title">Support this channel</div>
10 <div class="content">{{ videoChannel.support }}</div> 10 <div class="content" [innerHtml]="supportHTML"></div>
11 </div> 11 </div>
12 </div> 12 </div>
13 13
diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
index dc0893962..901c91de9 100644
--- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
+++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
@@ -4,6 +4,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser
4import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 4import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
5import { I18n } from '@ngx-translate/i18n-polyfill' 5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { Subscription } from 'rxjs' 6import { Subscription } from 'rxjs'
7import { MarkdownService } from '@app/videos/shared'
7 8
8@Component({ 9@Component({
9 selector: 'my-video-channel-about', 10 selector: 'my-video-channel-about',
@@ -12,19 +13,27 @@ import { Subscription } from 'rxjs'
12}) 13})
13export class VideoChannelAboutComponent implements OnInit, OnDestroy { 14export class VideoChannelAboutComponent implements OnInit, OnDestroy {
14 videoChannel: VideoChannel 15 videoChannel: VideoChannel
16 descriptionHTML = ''
17 supportHTML = ''
15 18
16 private videoChannelSub: Subscription 19 private videoChannelSub: Subscription
17 20
18 constructor ( 21 constructor (
19 private route: ActivatedRoute, 22 private route: ActivatedRoute,
20 private i18n: I18n, 23 private i18n: I18n,
21 private videoChannelService: VideoChannelService 24 private videoChannelService: VideoChannelService,
25 private markdownService: MarkdownService
22 ) { } 26 ) { }
23 27
24 ngOnInit () { 28 ngOnInit () {
25 // Parent get the video channel for us 29 // Parent get the video channel for us
26 this.videoChannelSub = this.videoChannelService.videoChannelLoaded 30 this.videoChannelSub = this.videoChannelService.videoChannelLoaded
27 .subscribe(videoChannel => this.videoChannel = videoChannel) 31 .subscribe(videoChannel => {
32 this.videoChannel = videoChannel
33
34 this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.videoChannel.description)
35 this.supportHTML = this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support)
36 })
28 } 37 }
29 38
30 ngOnDestroy () { 39 ngOnDestroy () {
@@ -32,7 +41,7 @@ export class VideoChannelAboutComponent implements OnInit, OnDestroy {
32 } 41 }
33 42
34 getVideoChannelDescription () { 43 getVideoChannelDescription () {
35 if (this.videoChannel.description) return this.videoChannel.description 44 if (this.descriptionHTML) return this.descriptionHTML
36 45
37 return this.i18n('No description') 46 return this.i18n('No description')
38 } 47 }