diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-27 17:09:43 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-09-05 10:17:02 +0200 |
commit | 421d935d256db5b77a652d8da0c9a38cb57147ba (patch) | |
tree | 972810106cd0f620713833e65c3ec861d241d155 /client/src/app/shared/misc/help.component.ts | |
parent | 4402b54dce0fe652ba71326f0dc74db287963260 (diff) | |
download | PeerTube-421d935d256db5b77a652d8da0c9a38cb57147ba.tar.gz PeerTube-421d935d256db5b77a652d8da0c9a38cb57147ba.tar.zst PeerTube-421d935d256db5b77a652d8da0c9a38cb57147ba.zip |
Add about information in registration page
Diffstat (limited to 'client/src/app/shared/misc/help.component.ts')
-rw-r--r-- | client/src/app/shared/misc/help.component.ts | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts index f3426f70f..18ba8ad5e 100644 --- a/client/src/app/shared/misc/help.component.ts +++ b/client/src/app/shared/misc/help.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, Input, OnChanges, OnInit } from '@angular/core' | 1 | import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core' |
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
3 | import { MarkdownService } from '@app/shared/renderer' | 3 | import { MarkdownService } from '@app/shared/renderer' |
4 | import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' | ||
4 | 5 | ||
5 | @Component({ | 6 | @Component({ |
6 | selector: 'my-help', | 7 | selector: 'my-help', |
@@ -8,22 +9,42 @@ import { MarkdownService } from '@app/shared/renderer' | |||
8 | templateUrl: './help.component.html' | 9 | templateUrl: './help.component.html' |
9 | }) | 10 | }) |
10 | 11 | ||
11 | export class HelpComponent implements OnInit, OnChanges { | 12 | export class HelpComponent implements OnInit, OnChanges, AfterContentInit { |
12 | @Input() preHtml = '' | ||
13 | @Input() postHtml = '' | ||
14 | @Input() customHtml = '' | ||
15 | @Input() helpType: 'custom' | 'markdownText' | 'markdownEnhanced' = 'custom' | 13 | @Input() helpType: 'custom' | 'markdownText' | 'markdownEnhanced' = 'custom' |
16 | @Input() tooltipPlacement = 'right' | 14 | @Input() tooltipPlacement = 'right' |
17 | 15 | ||
16 | @ContentChildren(PeerTubeTemplateDirective) templates: QueryList<PeerTubeTemplateDirective<'preHtml' | 'customHtml' | 'postHtml'>> | ||
17 | |||
18 | isPopoverOpened = false | 18 | isPopoverOpened = false |
19 | mainHtml = '' | 19 | mainHtml = '' |
20 | 20 | ||
21 | preHtmlTemplate: TemplateRef<any> | ||
22 | customHtmlTemplate: TemplateRef<any> | ||
23 | postHtmlTemplate: TemplateRef<any> | ||
24 | |||
21 | constructor (private i18n: I18n) { } | 25 | constructor (private i18n: I18n) { } |
22 | 26 | ||
23 | ngOnInit () { | 27 | ngOnInit () { |
24 | this.init() | 28 | this.init() |
25 | } | 29 | } |
26 | 30 | ||
31 | ngAfterContentInit () { | ||
32 | { | ||
33 | const t = this.templates.find(t => t.name === 'preHtml') | ||
34 | if (t) this.preHtmlTemplate = t.template | ||
35 | } | ||
36 | |||
37 | { | ||
38 | const t = this.templates.find(t => t.name === 'customHtml') | ||
39 | if (t) this.customHtmlTemplate = t.template | ||
40 | } | ||
41 | |||
42 | { | ||
43 | const t = this.templates.find(t => t.name === 'postHtml') | ||
44 | if (t) this.postHtmlTemplate = t.template | ||
45 | } | ||
46 | } | ||
47 | |||
27 | ngOnChanges () { | 48 | ngOnChanges () { |
28 | this.init() | 49 | this.init() |
29 | } | 50 | } |
@@ -37,11 +58,6 @@ export class HelpComponent implements OnInit, OnChanges { | |||
37 | } | 58 | } |
38 | 59 | ||
39 | private init () { | 60 | private init () { |
40 | if (this.helpType === 'custom') { | ||
41 | this.mainHtml = this.customHtml | ||
42 | return | ||
43 | } | ||
44 | |||
45 | if (this.helpType === 'markdownText') { | 61 | if (this.helpType === 'markdownText') { |
46 | this.mainHtml = this.formatMarkdownSupport(MarkdownService.TEXT_RULES) | 62 | this.mainHtml = this.formatMarkdownSupport(MarkdownService.TEXT_RULES) |
47 | return | 63 | return |