diff options
Diffstat (limited to 'client/src/app/shared/forms')
5 files changed, 14 insertions, 4 deletions
diff --git a/client/src/app/shared/forms/form-reactive.ts b/client/src/app/shared/forms/form-reactive.ts index e4f7481b5..0bb7d25e6 100644 --- a/client/src/app/shared/forms/form-reactive.ts +++ b/client/src/app/shared/forms/form-reactive.ts | |||
@@ -23,7 +23,7 @@ export abstract class FormReactive { | |||
23 | this.formErrors = formErrors | 23 | this.formErrors = formErrors |
24 | this.validationMessages = validationMessages | 24 | this.validationMessages = validationMessages |
25 | 25 | ||
26 | this.form.valueChanges.subscribe(data => this.onValueChanged(false)) | 26 | this.form.valueChanges.subscribe(() => this.onValueChanged(false)) |
27 | } | 27 | } |
28 | 28 | ||
29 | protected onValueChanged (forceCheck = false) { | 29 | protected onValueChanged (forceCheck = false) { |
diff --git a/client/src/app/shared/forms/form-validators/form-validator.service.ts b/client/src/app/shared/forms/form-validators/form-validator.service.ts index d10e17ca7..19a8bef25 100644 --- a/client/src/app/shared/forms/form-validators/form-validator.service.ts +++ b/client/src/app/shared/forms/form-validators/form-validator.service.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' | 1 | import { FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms' |
2 | import { Injectable } from '@angular/core' | 2 | import { Injectable } from '@angular/core' |
3 | import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared/forms/form-reactive' | 3 | import { FormReactiveErrors, FormReactiveValidationMessages } from '@app/shared/forms/form-reactive' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | 4 | ||
6 | export type BuildFormValidator = { | 5 | export type BuildFormValidator = { |
7 | VALIDATORS: ValidatorFn[], | 6 | VALIDATORS: ValidatorFn[], |
@@ -18,8 +17,7 @@ export type BuildFormDefaultValues = { | |||
18 | export class FormValidatorService { | 17 | export class FormValidatorService { |
19 | 18 | ||
20 | constructor ( | 19 | constructor ( |
21 | private formBuilder: FormBuilder, | 20 | private formBuilder: FormBuilder |
22 | private i18n: I18n | ||
23 | ) {} | 21 | ) {} |
24 | 22 | ||
25 | buildForm (obj: BuildFormArgument, defaultValues: BuildFormDefaultValues = {}) { | 23 | buildForm (obj: BuildFormArgument, defaultValues: BuildFormDefaultValues = {}) { |
diff --git a/client/src/app/shared/forms/form-validators/user-validators.service.ts b/client/src/app/shared/forms/form-validators/user-validators.service.ts index bb6ff2068..5edae2e38 100644 --- a/client/src/app/shared/forms/form-validators/user-validators.service.ts +++ b/client/src/app/shared/forms/form-validators/user-validators.service.ts | |||
@@ -12,6 +12,7 @@ export class UserValidatorsService { | |||
12 | readonly USER_ROLE: BuildFormValidator | 12 | readonly USER_ROLE: BuildFormValidator |
13 | readonly USER_DISPLAY_NAME: BuildFormValidator | 13 | readonly USER_DISPLAY_NAME: BuildFormValidator |
14 | readonly USER_DESCRIPTION: BuildFormValidator | 14 | readonly USER_DESCRIPTION: BuildFormValidator |
15 | readonly USER_TERMS: BuildFormValidator | ||
15 | 16 | ||
16 | constructor (private i18n: I18n) { | 17 | constructor (private i18n: I18n) { |
17 | 18 | ||
@@ -89,5 +90,14 @@ export class UserValidatorsService { | |||
89 | 'maxlength': this.i18n('Description cannot be more than 250 characters long.') | 90 | 'maxlength': this.i18n('Description cannot be more than 250 characters long.') |
90 | } | 91 | } |
91 | } | 92 | } |
93 | |||
94 | this.USER_TERMS = { | ||
95 | VALIDATORS: [ | ||
96 | Validators.requiredTrue | ||
97 | ], | ||
98 | MESSAGES: { | ||
99 | 'required': this.i18n('You must to agree with the instance terms in order to registering on it.') | ||
100 | } | ||
101 | } | ||
92 | } | 102 | } |
93 | } | 103 | } |
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.html b/client/src/app/shared/forms/peertube-checkbox.component.html index 820e7a621..38691f050 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.html +++ b/client/src/app/shared/forms/peertube-checkbox.component.html | |||
@@ -3,6 +3,7 @@ | |||
3 | <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="isDisabled" /> | 3 | <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="isDisabled" /> |
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 | </label> | 7 | </label> |
7 | 8 | ||
8 | <my-help *ngIf="helpHtml" tooltipPlacement="top" helpType="custom" i18n-customHtml [customHtml]="helpHtml"></my-help> | 9 | <my-help *ngIf="helpHtml" tooltipPlacement="top" helpType="custom" i18n-customHtml [customHtml]="helpHtml"></my-help> |
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/forms/peertube-checkbox.component.ts index c626c4c5d..bbc9904df 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/forms/peertube-checkbox.component.ts | |||
@@ -17,6 +17,7 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor { | |||
17 | @Input() checked = false | 17 | @Input() checked = false |
18 | @Input() inputName: string | 18 | @Input() inputName: string |
19 | @Input() labelText: string | 19 | @Input() labelText: string |
20 | @Input() labelHtml: string | ||
20 | @Input() helpHtml: string | 21 | @Input() helpHtml: string |
21 | 22 | ||
22 | isDisabled = false | 23 | isDisabled = false |