aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/shared/shared-forms/dynamic-form-field.component.html10
-rw-r--r--shared/models/plugins/register-client-form-field.model.ts14
-rw-r--r--shared/models/plugins/register-server-setting.model.ts2
3 files changed, 20 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.html b/client/src/app/shared/shared-forms/dynamic-form-field.component.html
index c358cb119..8e9ef5355 100644
--- a/client/src/app/shared/shared-forms/dynamic-form-field.component.html
+++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.html
@@ -1,10 +1,16 @@
1<div [formGroup]="form"> 1<div [formGroup]="form">
2 <label *ngIf="setting.type !== 'input-checkbox'" [attr.for]="setting.name" [innerHTML]="setting.label"></label> 2 <label *ngIf="setting.label" [attr.for]="setting.name" [innerHTML]="setting.label"></label>
3 3
4 <div *ngIf="setting.descriptionHTML" class="label-small-info" [innerHTML]="setting.descriptionHTML"></div> 4 <div *ngIf="setting.descriptionHTML" class="label-small-info" [innerHTML]="setting.descriptionHTML"></div>
5 5
6 <input *ngIf="setting.type === 'input'" type="text" [id]="setting.name" [formControlName]="setting.name" /> 6 <input *ngIf="setting.type === 'input'" type="text" [id]="setting.name" [formControlName]="setting.name" />
7 7
8 <div *ngIf="setting.type === 'select'" class="peertube-select-container">
9 <select [id]="setting.name" [formControlName]="setting.name" class="form-control">
10 <option *ngFor="let option of setting.options" [value]="option.value">{{ option.label }}</option>
11 </select>
12 </div>
13
8 <my-input-toggle-hidden *ngIf="setting.type === 'input-password'" [formControlName]="setting.name" [inputId]="setting.name"></my-input-toggle-hidden> 14 <my-input-toggle-hidden *ngIf="setting.type === 'input-password'" [formControlName]="setting.name" [inputId]="setting.name"></my-input-toggle-hidden>
9 15
10 <textarea *ngIf="setting.type === 'input-textarea'" type="text" [id]="setting.name" [formControlName]="setting.name"></textarea> 16 <textarea *ngIf="setting.type === 'input-textarea'" type="text" [id]="setting.name" [formControlName]="setting.name"></textarea>
@@ -32,6 +38,8 @@
32 [labelInnerHTML]="setting.label" 38 [labelInnerHTML]="setting.label"
33 ></my-peertube-checkbox> 39 ></my-peertube-checkbox>
34 40
41 <div *ngIf="setting.type === 'html'" [innerHTML]="setting.html"></div>
42
35 <div *ngIf="formErrors[setting.name]" class="form-error"> 43 <div *ngIf="formErrors[setting.name]" class="form-error">
36 {{ formErrors[setting.name] }} 44 {{ formErrors[setting.name] }}
37 </div> 45 </div>
diff --git a/shared/models/plugins/register-client-form-field.model.ts b/shared/models/plugins/register-client-form-field.model.ts
index 641d7490c..cdcdaa181 100644
--- a/shared/models/plugins/register-client-form-field.model.ts
+++ b/shared/models/plugins/register-client-form-field.model.ts
@@ -1,7 +1,13 @@
1export interface RegisterClientFormFieldOptions { 1export type RegisterClientFormFieldOptions = {
2 name: string 2 name?: string
3 label: string 3 label?: string
4 type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced' 4 type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced' | 'select' | 'html'
5
6 // For select type
7 options?: { value: string, label: string }[]
8
9 // For html type
10 html?: string
5 11
6 descriptionHTML?: string 12 descriptionHTML?: string
7 13
diff --git a/shared/models/plugins/register-server-setting.model.ts b/shared/models/plugins/register-server-setting.model.ts
index 6872dc53e..6bc25b4ae 100644
--- a/shared/models/plugins/register-server-setting.model.ts
+++ b/shared/models/plugins/register-server-setting.model.ts
@@ -1,6 +1,6 @@
1import { RegisterClientFormFieldOptions } from './register-client-form-field.model' 1import { RegisterClientFormFieldOptions } from './register-client-form-field.model'
2 2
3export interface RegisterServerSettingOptions extends RegisterClientFormFieldOptions { 3export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & {
4 // If the setting is not private, anyone can view its value (client code included) 4 // If the setting is not private, anyone can view its value (client code included)
5 // If the setting is private, only server-side hooks can access it 5 // If the setting is private, only server-side hooks can access it
6 // Mainly used by the PeerTube client to get admin config 6 // Mainly used by the PeerTube client to get admin config