Plugins can register html/select settings
This commit is contained in:
parent
55b84d5346
commit
32d13b203b
3 changed files with 20 additions and 6 deletions
|
@ -1,10 +1,16 @@
|
||||||
<div [formGroup]="form">
|
<div [formGroup]="form">
|
||||||
<label *ngIf="setting.type !== 'input-checkbox'" [attr.for]="setting.name" [innerHTML]="setting.label"></label>
|
<label *ngIf="setting.label" [attr.for]="setting.name" [innerHTML]="setting.label"></label>
|
||||||
|
|
||||||
<div *ngIf="setting.descriptionHTML" class="label-small-info" [innerHTML]="setting.descriptionHTML"></div>
|
<div *ngIf="setting.descriptionHTML" class="label-small-info" [innerHTML]="setting.descriptionHTML"></div>
|
||||||
|
|
||||||
<input *ngIf="setting.type === 'input'" type="text" [id]="setting.name" [formControlName]="setting.name" />
|
<input *ngIf="setting.type === 'input'" type="text" [id]="setting.name" [formControlName]="setting.name" />
|
||||||
|
|
||||||
|
<div *ngIf="setting.type === 'select'" class="peertube-select-container">
|
||||||
|
<select [id]="setting.name" [formControlName]="setting.name" class="form-control">
|
||||||
|
<option *ngFor="let option of setting.options" [value]="option.value">{{ option.label }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<my-input-toggle-hidden *ngIf="setting.type === 'input-password'" [formControlName]="setting.name" [inputId]="setting.name"></my-input-toggle-hidden>
|
<my-input-toggle-hidden *ngIf="setting.type === 'input-password'" [formControlName]="setting.name" [inputId]="setting.name"></my-input-toggle-hidden>
|
||||||
|
|
||||||
<textarea *ngIf="setting.type === 'input-textarea'" type="text" [id]="setting.name" [formControlName]="setting.name"></textarea>
|
<textarea *ngIf="setting.type === 'input-textarea'" type="text" [id]="setting.name" [formControlName]="setting.name"></textarea>
|
||||||
|
@ -32,6 +38,8 @@
|
||||||
[labelInnerHTML]="setting.label"
|
[labelInnerHTML]="setting.label"
|
||||||
></my-peertube-checkbox>
|
></my-peertube-checkbox>
|
||||||
|
|
||||||
|
<div *ngIf="setting.type === 'html'" [innerHTML]="setting.html"></div>
|
||||||
|
|
||||||
<div *ngIf="formErrors[setting.name]" class="form-error">
|
<div *ngIf="formErrors[setting.name]" class="form-error">
|
||||||
{{ formErrors[setting.name] }}
|
{{ formErrors[setting.name] }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
export interface RegisterClientFormFieldOptions {
|
export type RegisterClientFormFieldOptions = {
|
||||||
name: string
|
name?: string
|
||||||
label: string
|
label?: string
|
||||||
type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced'
|
type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced' | 'select' | 'html'
|
||||||
|
|
||||||
|
// For select type
|
||||||
|
options?: { value: string, label: string }[]
|
||||||
|
|
||||||
|
// For html type
|
||||||
|
html?: string
|
||||||
|
|
||||||
descriptionHTML?: string
|
descriptionHTML?: string
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { RegisterClientFormFieldOptions } from './register-client-form-field.model'
|
import { RegisterClientFormFieldOptions } from './register-client-form-field.model'
|
||||||
|
|
||||||
export interface RegisterServerSettingOptions extends RegisterClientFormFieldOptions {
|
export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & {
|
||||||
// If the setting is not private, anyone can view its value (client code included)
|
// If the setting is not private, anyone can view its value (client code included)
|
||||||
// If the setting is private, only server-side hooks can access it
|
// If the setting is private, only server-side hooks can access it
|
||||||
// Mainly used by the PeerTube client to get admin config
|
// Mainly used by the PeerTube client to get admin config
|
||||||
|
|
Loading…
Reference in a new issue