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/forms | |
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/forms')
-rw-r--r-- | client/src/app/shared/forms/peertube-checkbox.component.html | 11 | ||||
-rw-r--r-- | client/src/app/shared/forms/peertube-checkbox.component.ts | 24 |
2 files changed, 29 insertions, 6 deletions
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.html b/client/src/app/shared/forms/peertube-checkbox.component.html index 571a1a673..f1e3bf0bf 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.html +++ b/client/src/app/shared/forms/peertube-checkbox.component.html | |||
@@ -3,8 +3,15 @@ | |||
3 | <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="disabled" /> | 3 | <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="disabled" /> |
4 | <span role="checkbox" [attr.aria-checked]="checked"></span> | 4 | <span role="checkbox" [attr.aria-checked]="checked"></span> |
5 | <span *ngIf="labelText">{{ labelText }}</span> | 5 | <span *ngIf="labelText">{{ labelText }}</span> |
6 | <span *ngIf="labelHtml" [innerHTML]="labelHtml"></span> | 6 | |
7 | <span *ngIf="labelTemplate"> | ||
8 | <ng-container *ngTemplateOutlet="labelTemplate"></ng-container> | ||
9 | </span> | ||
7 | </label> | 10 | </label> |
8 | 11 | ||
9 | <my-help *ngIf="helpHtml" [tooltipPlacement]="helpPlacement" helpType="custom" i18n-customHtml [customHtml]="helpHtml"></my-help> | 12 | <my-help *ngIf="helpTemplate" [tooltipPlacement]="helpPlacement" helpType="custom"> |
13 | <ng-template ptTemplate="customHtml"> | ||
14 | <ng-template *ngTemplateOutlet="helpTemplate"></ng-template> | ||
15 | </ng-template> | ||
16 | </my-help> | ||
10 | </div> | 17 | </div> |
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/forms/peertube-checkbox.component.ts index a4b72aa37..3b8f39ed0 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/forms/peertube-checkbox.component.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { ChangeDetectorRef, Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core' | 1 | import { AfterContentInit, ChangeDetectorRef, Component, ContentChildren, forwardRef, Input, QueryList, TemplateRef } from '@angular/core' |
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive' | ||
3 | 4 | ||
4 | @Component({ | 5 | @Component({ |
5 | selector: 'my-peertube-checkbox', | 6 | selector: 'my-peertube-checkbox', |
@@ -13,20 +14,35 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | |||
13 | } | 14 | } |
14 | ] | 15 | ] |
15 | }) | 16 | }) |
16 | export class PeertubeCheckboxComponent implements ControlValueAccessor { | 17 | export class PeertubeCheckboxComponent implements ControlValueAccessor, AfterContentInit { |
17 | @Input() checked = false | 18 | @Input() checked = false |
18 | @Input() inputName: string | 19 | @Input() inputName: string |
19 | @Input() labelText: string | 20 | @Input() labelText: string |
20 | @Input() labelHtml: string | ||
21 | @Input() helpHtml: string | ||
22 | @Input() helpPlacement = 'top' | 21 | @Input() helpPlacement = 'top' |
23 | @Input() disabled = false | 22 | @Input() disabled = false |
24 | 23 | ||
24 | @ContentChildren(PeerTubeTemplateDirective) templates: QueryList<PeerTubeTemplateDirective<'label' | 'help'>> | ||
25 | |||
25 | // FIXME: https://github.com/angular/angular/issues/10816#issuecomment-307567836 | 26 | // FIXME: https://github.com/angular/angular/issues/10816#issuecomment-307567836 |
26 | @Input() onPushWorkaround = false | 27 | @Input() onPushWorkaround = false |
27 | 28 | ||
29 | labelTemplate: TemplateRef<any> | ||
30 | helpTemplate: TemplateRef<any> | ||
31 | |||
28 | constructor (private cdr: ChangeDetectorRef) { } | 32 | constructor (private cdr: ChangeDetectorRef) { } |
29 | 33 | ||
34 | ngAfterContentInit () { | ||
35 | { | ||
36 | const t = this.templates.find(t => t.name === 'label') | ||
37 | if (t) this.labelTemplate = t.template | ||
38 | } | ||
39 | |||
40 | { | ||
41 | const t = this.templates.find(t => t.name === 'help') | ||
42 | if (t) this.helpTemplate = t.template | ||
43 | } | ||
44 | } | ||
45 | |||
30 | propagateChange = (_: any) => { /* empty */ } | 46 | propagateChange = (_: any) => { /* empty */ } |
31 | 47 | ||
32 | writeValue (checked: boolean) { | 48 | writeValue (checked: boolean) { |