diff options
Diffstat (limited to 'client/src/app/shared')
3 files changed, 14 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-forms/select/select-checkbox.component.html b/client/src/app/shared/shared-forms/select/select-checkbox.component.html index 3f81dd152..f5af2932e 100644 --- a/client/src/app/shared/shared-forms/select/select-checkbox.component.html +++ b/client/src/app/shared/shared-forms/select/select-checkbox.component.html | |||
@@ -2,7 +2,7 @@ | |||
2 | [items]="availableItems" | 2 | [items]="availableItems" |
3 | [(ngModel)]="selectedItems" | 3 | [(ngModel)]="selectedItems" |
4 | (ngModelChange)="onModelChange()" | 4 | (ngModelChange)="onModelChange()" |
5 | i18n-placeholder placeholder="Add a new language" | 5 | [placeholder]="placeholder" |
6 | [clearable]="true" | 6 | [clearable]="true" |
7 | [multiple]="true" | 7 | [multiple]="true" |
8 | [searchable]="true" | 8 | [searchable]="true" |
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 93653fef1..fd683ae5d 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 | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, Input, forwardRef } from '@angular/core' | 1 | import { Component, Input, forwardRef, OnInit } from '@angular/core' |
2 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms' | 2 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms' |
3 | import { SelectOptionsItem } from './select-options.component' | 3 | import { SelectOptionsItem } from './select-options.component' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | 5 | ||
5 | export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string | 6 | export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string |
6 | 7 | ||
@@ -16,12 +17,21 @@ export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | | |||
16 | } | 17 | } |
17 | ] | 18 | ] |
18 | }) | 19 | }) |
19 | export class SelectCheckboxComponent implements ControlValueAccessor { | 20 | export class SelectCheckboxComponent implements OnInit, ControlValueAccessor { |
20 | @Input() availableItems: SelectOptionsItem[] = [] | 21 | @Input() availableItems: SelectOptionsItem[] = [] |
21 | @Input() selectedItems: ItemSelectCheckboxValue[] = [] | 22 | @Input() selectedItems: ItemSelectCheckboxValue[] = [] |
22 | @Input() selectableGroup: boolean | 23 | @Input() selectableGroup: boolean |
23 | @Input() selectableGroupAsModel: boolean | 24 | @Input() selectableGroupAsModel: boolean |
24 | @Input() maxSelectedItems: number | 25 | @Input() maxSelectedItems: number |
26 | @Input() placeholder: string | ||
27 | |||
28 | constructor ( | ||
29 | private i18n: I18n | ||
30 | ) {} | ||
31 | |||
32 | ngOnInit () { | ||
33 | if (!this.placeholder) this.placeholder = this.i18n('Add a new option') | ||
34 | } | ||
25 | 35 | ||
26 | propagateChange = (_: any) => { /* empty */ } | 36 | propagateChange = (_: any) => { /* empty */ } |
27 | 37 | ||
diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.html b/client/src/app/shared/shared-user-settings/user-video-settings.component.html index 655b49e18..aa261fdce 100644 --- a/client/src/app/shared/shared-user-settings/user-video-settings.component.html +++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.html | |||
@@ -33,6 +33,7 @@ | |||
33 | <my-select-checkbox | 33 | <my-select-checkbox |
34 | formControlName="videoLanguages" [availableItems]="languageItems" | 34 | formControlName="videoLanguages" [availableItems]="languageItems" |
35 | [selectableGroup]="true" [selectableGroupAsModel]="true" | 35 | [selectableGroup]="true" [selectableGroupAsModel]="true" |
36 | i18n-placeholder placeholder="Add a new language" | ||
36 | > | 37 | > |
37 | </my-select-checkbox > | 38 | </my-select-checkbox > |
38 | </div> | 39 | </div> |