diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-25 10:28:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-25 10:28:43 +0200 |
commit | 772d5642ba617865519ca5e590061adf174866d4 (patch) | |
tree | 27e2f3c9a78a4de67128f005d2bd73a5eecca804 /client/src/app/shared | |
parent | d73c98884ec7f970ed95a01fb2d445d10c53c817 (diff) | |
download | PeerTube-772d5642ba617865519ca5e590061adf174866d4.tar.gz PeerTube-772d5642ba617865519ca5e590061adf174866d4.tar.zst PeerTube-772d5642ba617865519ca5e590061adf174866d4.zip |
Improve captions UX (at least I've tried)
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/forms/form-reactive.ts | 3 | ||||
-rw-r--r-- | client/src/app/shared/forms/reactive-file.component.html | 2 | ||||
-rw-r--r-- | client/src/app/shared/forms/reactive-file.component.ts | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/client/src/app/shared/forms/form-reactive.ts b/client/src/app/shared/forms/form-reactive.ts index 441ec8203..e4f7481b5 100644 --- a/client/src/app/shared/forms/form-reactive.ts +++ b/client/src/app/shared/forms/form-reactive.ts | |||
@@ -10,6 +10,7 @@ export type FormReactiveValidationMessages = { | |||
10 | 10 | ||
11 | export abstract class FormReactive { | 11 | export abstract class FormReactive { |
12 | protected abstract formValidatorService: FormValidatorService | 12 | protected abstract formValidatorService: FormValidatorService |
13 | protected formChanged = false | ||
13 | 14 | ||
14 | form: FormGroup | 15 | form: FormGroup |
15 | formErrors: FormReactiveErrors | 16 | formErrors: FormReactiveErrors |
@@ -31,6 +32,8 @@ export abstract class FormReactive { | |||
31 | this.formErrors[ field ] = '' | 32 | this.formErrors[ field ] = '' |
32 | const control = this.form.get(field) | 33 | const control = this.form.get(field) |
33 | 34 | ||
35 | if (control.dirty) this.formChanged = true | ||
36 | |||
34 | // Don't care if dirty on force check | 37 | // Don't care if dirty on force check |
35 | const isDirty = control.dirty || forceCheck === true | 38 | const isDirty = control.dirty || forceCheck === true |
36 | if (control && isDirty && !control.valid) { | 39 | if (control && isDirty && !control.valid) { |
diff --git a/client/src/app/shared/forms/reactive-file.component.html b/client/src/app/shared/forms/reactive-file.component.html index 9fb1c9e3e..7d691059d 100644 --- a/client/src/app/shared/forms/reactive-file.component.html +++ b/client/src/app/shared/forms/reactive-file.component.html | |||
@@ -4,7 +4,7 @@ | |||
4 | <input | 4 | <input |
5 | type="file" | 5 | type="file" |
6 | [name]="inputName" [id]="inputName" [accept]="extensions" | 6 | [name]="inputName" [id]="inputName" [accept]="extensions" |
7 | (change)="fileChange($event)" | 7 | (change)="fileChange($event)" [(ngModel)]="fileInputValue" |
8 | /> | 8 | /> |
9 | </div> | 9 | </div> |
10 | 10 | ||
diff --git a/client/src/app/shared/forms/reactive-file.component.ts b/client/src/app/shared/forms/reactive-file.component.ts index f5758b643..8d22aa56c 100644 --- a/client/src/app/shared/forms/reactive-file.component.ts +++ b/client/src/app/shared/forms/reactive-file.component.ts | |||
@@ -25,6 +25,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { | |||
25 | @Output() fileChanged = new EventEmitter<Blob>() | 25 | @Output() fileChanged = new EventEmitter<Blob>() |
26 | 26 | ||
27 | allowedExtensionsMessage = '' | 27 | allowedExtensionsMessage = '' |
28 | fileInputValue: any | ||
28 | 29 | ||
29 | private file: File | 30 | private file: File |
30 | 31 | ||
@@ -63,6 +64,8 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { | |||
63 | 64 | ||
64 | writeValue (file: any) { | 65 | writeValue (file: any) { |
65 | this.file = file | 66 | this.file = file |
67 | |||
68 | if (!this.file) this.fileInputValue = null | ||
66 | } | 69 | } |
67 | 70 | ||
68 | registerOnChange (fn: (_: any) => void) { | 71 | registerOnChange (fn: (_: any) => void) { |