aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-08-11 16:52:20 +0200
committerRigel Kent <sendmemail@rigelk.eu>2020-08-11 16:52:26 +0200
commit857961f0ee39f90dc3267cebd2b5e3f718115d06 (patch)
tree3861a8383d74c6e95109fb471c374e94eb73883d
parent94676e631c5045144da598fefbefaa3cfcaaeb0d (diff)
downloadPeerTube-857961f0ee39f90dc3267cebd2b5e3f718115d06.tar.gz
PeerTube-857961f0ee39f90dc3267cebd2b5e3f718115d06.tar.zst
PeerTube-857961f0ee39f90dc3267cebd2b5e3f718115d06.zip
adapt my-select-checkbox placeholder to its context
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html2
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.html1
-rw-r--r--client/src/app/shared/shared-forms/select/select-checkbox.component.html2
-rw-r--r--client/src/app/shared/shared-forms/select/select-checkbox.component.ts14
-rw-r--r--client/src/app/shared/shared-user-settings/user-video-settings.component.html1
5 files changed, 17 insertions, 3 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
index b82281c6c..227137f48 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
@@ -52,6 +52,7 @@
52 id="instanceCategories" 52 id="instanceCategories"
53 formControlName="categories" [availableItems]="categoryItems" 53 formControlName="categories" [availableItems]="categoryItems"
54 [selectableGroup]="false" 54 [selectableGroup]="false"
55 i18n-placeholder placeholder="Add a new category"
55 > 56 >
56 </my-select-checkbox> 57 </my-select-checkbox>
57 </div> 58 </div>
@@ -65,6 +66,7 @@
65 id="instanceLanguages" 66 id="instanceLanguages"
66 formControlName="languages" [availableItems]="languageItems" 67 formControlName="languages" [availableItems]="languageItems"
67 [selectableGroup]="false" 68 [selectableGroup]="false"
69 i18n-placeholder placeholder="Add a new language"
68 > 70 >
69 </my-select-checkbox> 71 </my-select-checkbox>
70 </div> 72 </div>
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html
index d02f6526f..e289bc097 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.html
+++ b/client/src/app/+admin/users/user-list/user-list.component.html
@@ -61,6 +61,7 @@
61 name="columns" 61 name="columns"
62 [availableItems]="columns" 62 [availableItems]="columns"
63 [selectableGroup]="false" [(ngModel)]="selectedColumns" 63 [selectableGroup]="false" [(ngModel)]="selectedColumns"
64 i18n-placeholder placeholder="Select columns"
64 > 65 >
65 </my-select-checkbox> 66 </my-select-checkbox>
66 </div> 67 </div>
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 @@
1import { Component, Input, forwardRef } from '@angular/core' 1import { Component, Input, forwardRef, OnInit } from '@angular/core'
2import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms' 2import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'
3import { SelectOptionsItem } from './select-options.component' 3import { SelectOptionsItem } from './select-options.component'
4import { I18n } from '@ngx-translate/i18n-polyfill'
4 5
5export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string 6export 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})
19export class SelectCheckboxComponent implements ControlValueAccessor { 20export 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>