Merge branch 'checkbox-input-plugin' into 'develop'

(plugins) adding checkbox and textarea as possible input types, add links in form label

See merge request framasoft/peertube/PeerTube!25
This commit is contained in:
Chocobozzz 2019-11-25 11:19:45 +01:00
commit f84dde5e12
5 changed files with 15 additions and 3 deletions

View File

@ -7,9 +7,16 @@
<form *ngIf="hasRegisteredSettings()" role="form" (ngSubmit)="formValidated()" [formGroup]="form">
<div class="form-group" *ngFor="let setting of registeredSettings">
<label [attr.for]="setting.name">{{ setting.label }}</label>
<label *ngIf="setting.type !== 'input-checkbox'" [attr.for]="setting.name" [innerHTML]="setting.label"></label>
<input *ngIf="setting.type === 'input'" type="text" [id]="setting.name" [formControlName]="setting.name" />
<textarea *ngIf="setting.type === 'input-textarea'" type="text" [id]="setting.name" [formControlName]="setting.name"></textarea>
<my-peertube-checkbox
*ngIf="setting.type === 'input-checkbox'"
[id]="setting.name"
[formControlName]="setting.name"
[labelInnerHTML]="setting.label"
></my-peertube-checkbox>
<div *ngIf="formErrors[setting.name]" class="form-error">
{{ formErrors[setting.name] }}

View File

@ -5,6 +5,7 @@ h2 {
margin-bottom: 20px;
}
textarea,
input:not([type=submit]) {
@include peertube-input-text(340px);
display: block;

View File

@ -21,7 +21,8 @@
}
.second-row {
display: flex;
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
justify-content: space-between;
@ -30,6 +31,7 @@
}
.buttons {
margin-left: 10px;
> *:not(:last-child) {
margin-right: 10px;
}

View File

@ -3,6 +3,7 @@
<input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="disabled" />
<span role="checkbox" [attr.aria-checked]="checked"></span>
<span *ngIf="labelText">{{ labelText }}</span>
<span *ngIf="!labelText && labelInnerHTML" [innerHTML]="labelInnerHTML"></span>
<span *ngIf="labelTemplate">
<ng-container *ngTemplateOutlet="labelTemplate"></ng-container>

View File

@ -18,6 +18,7 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor, AfterCon
@Input() checked = false
@Input() inputName: string
@Input() labelText: string
@Input() labelInnerHTML: string
@Input() helpPlacement = 'top'
@Input() disabled = false