diff options
author | Jelle Besseling <jelle@pingiun.com> | 2021-10-12 13:33:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 13:33:44 +0200 |
commit | 8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0 (patch) | |
tree | 755ba56bc3acbd82ec195974545581c1e49aae5e /client/src/app/shared/shared-forms/select/select-checkbox.component.ts | |
parent | badacdbb4a3e4a1aae4d324abc496be8e261b2ef (diff) | |
download | PeerTube-8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0.tar.gz PeerTube-8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0.tar.zst PeerTube-8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0.zip |
Allow configuration to be static/readonly (#4315)
* Allow configuration to be static/readonly
* Make all components disableable
* Improve disabled component styling
* Rename edits allowed field in configuration
* Fix CI
Diffstat (limited to 'client/src/app/shared/shared-forms/select/select-checkbox.component.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/select/select-checkbox.component.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-forms/select/select-checkbox.component.ts b/client/src/app/shared/shared-forms/select/select-checkbox.component.ts index 12f697628..c9a500324 100644 --- a/client/src/app/shared/shared-forms/select/select-checkbox.component.ts +++ b/client/src/app/shared/shared-forms/select/select-checkbox.component.ts | |||
@@ -23,6 +23,8 @@ export class SelectCheckboxComponent implements OnInit, ControlValueAccessor { | |||
23 | @Input() selectableGroupAsModel: boolean | 23 | @Input() selectableGroupAsModel: boolean |
24 | @Input() placeholder: string | 24 | @Input() placeholder: string |
25 | 25 | ||
26 | disabled = false | ||
27 | |||
26 | ngOnInit () { | 28 | ngOnInit () { |
27 | if (!this.placeholder) this.placeholder = $localize`Add a new option` | 29 | if (!this.placeholder) this.placeholder = $localize`Add a new option` |
28 | } | 30 | } |
@@ -59,6 +61,10 @@ export class SelectCheckboxComponent implements OnInit, ControlValueAccessor { | |||
59 | this.propagateChange(this.selectedItems) | 61 | this.propagateChange(this.selectedItems) |
60 | } | 62 | } |
61 | 63 | ||
64 | setDisabledState (isDisabled: boolean) { | ||
65 | this.disabled = isDisabled | ||
66 | } | ||
67 | |||
62 | compareFn (item: SelectOptionsItem, selected: ItemSelectCheckboxValue) { | 68 | compareFn (item: SelectOptionsItem, selected: ItemSelectCheckboxValue) { |
63 | if (typeof selected === 'string' || typeof selected === 'number') { | 69 | if (typeof selected === 'string' || typeof selected === 'number') { |
64 | return item.id === selected | 70 | return item.id === selected |