diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-11 16:07:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-11 16:18:42 +0200 |
commit | 52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4 (patch) | |
tree | 887d2b6106548ad23cf016d82baf1977198027d9 /client/src/app/shared/shared-forms/select/select-checkbox.component.html | |
parent | 3d25d5de33d8aa0ba00d7514522b25d22bf0e0a1 (diff) | |
download | PeerTube-52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4.tar.gz PeerTube-52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4.tar.zst PeerTube-52c4976fcf4ee255a3af68ff9778e4f5c4f84bd4.zip |
Use ng select for multiselect
Diffstat (limited to 'client/src/app/shared/shared-forms/select/select-checkbox.component.html')
-rw-r--r-- | client/src/app/shared/shared-forms/select/select-checkbox.component.html | 41 |
1 files changed, 41 insertions, 0 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 new file mode 100644 index 000000000..3f81dd152 --- /dev/null +++ b/client/src/app/shared/shared-forms/select/select-checkbox.component.html | |||
@@ -0,0 +1,41 @@ | |||
1 | <ng-select | ||
2 | [items]="availableItems" | ||
3 | [(ngModel)]="selectedItems" | ||
4 | (ngModelChange)="onModelChange()" | ||
5 | i18n-placeholder placeholder="Add a new language" | ||
6 | [clearable]="true" | ||
7 | [multiple]="true" | ||
8 | [searchable]="true" | ||
9 | [closeOnSelect]="false" | ||
10 | |||
11 | bindValue="id" | ||
12 | bindLabel="label" | ||
13 | |||
14 | notFoundText="No items found" i18n-notFoundText | ||
15 | |||
16 | [selectableGroup]="selectableGroup" | ||
17 | [selectableGroupAsModel]="selectableGroupAsModel" | ||
18 | |||
19 | groupBy="group" | ||
20 | [compareWith]="compareFn" | ||
21 | |||
22 | [maxSelectedItems]="maxSelectedItems" | ||
23 | > | ||
24 | |||
25 | <ng-template ng-optgroup-tmp let-item="item" let-item$="item$" let-index="index"> | ||
26 | <div class="form-group-checkbox"> | ||
27 | <input id="item-{{index}}" type="checkbox" [ngModel]="item$.selected"/> | ||
28 | <span role="checkbox" [attr.aria-checked]="item$.selected"></span> | ||
29 | <span>{{ item.group }}</span> | ||
30 | </div> | ||
31 | </ng-template> | ||
32 | |||
33 | <ng-template ng-option-tmp let-item="item" let-item$="item$" let-index="index"> | ||
34 | <div class="form-group-checkbox"> | ||
35 | <input id="item-{{index}}" type="checkbox" [ngModel]="item$.selected"/> | ||
36 | <span role="checkbox" [attr.aria-checked]="item$.selected"></span> | ||
37 | <span>{{ item.label }}</span> | ||
38 | </div> | ||
39 | </ng-template> | ||
40 | |||
41 | </ng-select> | ||