diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-14 16:31:10 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-14 16:31:14 +0100 |
commit | 728a1236aece26bce6452c440cf85622548afab9 (patch) | |
tree | c9bfcb0261ec845af199e95be3d7087bf68d7170 /client/src/app/shared/shared-forms/select | |
parent | 113d4a3f734de815b1565b892dcd9b41a9e283e6 (diff) | |
download | PeerTube-728a1236aece26bce6452c440cf85622548afab9.tar.gz PeerTube-728a1236aece26bce6452c440cf85622548afab9.tar.zst PeerTube-728a1236aece26bce6452c440cf85622548afab9.zip |
restore live transcoding to live streaming tab
Diffstat (limited to 'client/src/app/shared/shared-forms/select')
3 files changed, 58 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-forms/select/select-custom-input.component.html b/client/src/app/shared/shared-forms/select/select-custom-input.component.html new file mode 100644 index 000000000..84fa15c3d --- /dev/null +++ b/client/src/app/shared/shared-forms/select/select-custom-input.component.html | |||
@@ -0,0 +1,14 @@ | |||
1 | <ng-select | ||
2 | [(ngModel)]="selectedId" | ||
3 | (ngModelChange)="onModelChange()" | ||
4 | [bindLabel]="bindLabel" | ||
5 | [bindValue]="bindValue" | ||
6 | [clearable]="clearable" | ||
7 | [searchable]="searchable" | ||
8 | > | ||
9 | <ng-option *ngFor="let item of items" [value]="item.id"> | ||
10 | {{ channel.label }} | ||
11 | </ng-option> | ||
12 | |||
13 | <ng-content></ng-content> | ||
14 | </ng-select> | ||
diff --git a/client/src/app/shared/shared-forms/select/select-custom-input.component.scss b/client/src/app/shared/shared-forms/select/select-custom-input.component.scss new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/client/src/app/shared/shared-forms/select/select-custom-input.component.scss | |||
diff --git a/client/src/app/shared/shared-forms/select/select-custom-input.component.ts b/client/src/app/shared/shared-forms/select/select-custom-input.component.ts new file mode 100644 index 000000000..ba6fef8ad --- /dev/null +++ b/client/src/app/shared/shared-forms/select/select-custom-input.component.ts | |||
@@ -0,0 +1,44 @@ | |||
1 | import { Component, forwardRef, Input } from '@angular/core' | ||
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | ||
3 | |||
4 | @Component({ | ||
5 | selector: 'my-select-custom-input', | ||
6 | styleUrls: [ './select-custom-input.component.scss' ], | ||
7 | templateUrl: './select-custom-input.component.html', | ||
8 | providers: [ | ||
9 | { | ||
10 | provide: NG_VALUE_ACCESSOR, | ||
11 | useExisting: forwardRef(() => SelectCustomInputComponent), | ||
12 | multi: true | ||
13 | } | ||
14 | ] | ||
15 | }) | ||
16 | export class SelectCustomInputComponent implements ControlValueAccessor { | ||
17 | @Input() items: any[] = [] | ||
18 | |||
19 | selectedId: number | ||
20 | |||
21 | // ng-select options | ||
22 | bindLabel = 'label' | ||
23 | bindValue = 'id' | ||
24 | clearable = false | ||
25 | searchable = false | ||
26 | |||
27 | propagateChange = (_: any) => { /* empty */ } | ||
28 | |||
29 | writeValue (id: number) { | ||
30 | this.selectedId = id | ||
31 | } | ||
32 | |||
33 | registerOnChange (fn: (_: any) => void) { | ||
34 | this.propagateChange = fn | ||
35 | } | ||
36 | |||
37 | registerOnTouched () { | ||
38 | // Unused | ||
39 | } | ||
40 | |||
41 | onModelChange () { | ||
42 | this.propagateChange(this.selectedId) | ||
43 | } | ||
44 | } | ||