aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/components/list/video-sort.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/angular/videos/components/list/video-sort.component.ts')
-rw-r--r--client/angular/videos/components/list/video-sort.component.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/client/angular/videos/components/list/video-sort.component.ts b/client/angular/videos/components/list/video-sort.component.ts
new file mode 100644
index 000000000..e63a70e9e
--- /dev/null
+++ b/client/angular/videos/components/list/video-sort.component.ts
@@ -0,0 +1,36 @@
1import { Component, Input, Output, EventEmitter } from '@angular/core';
2
3import { SortField } from './sort';
4
5@Component({
6 selector: 'my-video-sort',
7 // styleUrls: [ 'app/angular/videos/components/list/video-sort.component.css' ],
8 templateUrl: 'app/angular/videos/components/list/video-sort.component.html'
9})
10
11export class VideoSortComponent {
12 @Output() sort = new EventEmitter<any>();
13
14 @Input() currentSort: SortField;
15
16 sortChoices = {
17 'name': 'Name - Asc',
18 '-name': "Name - Desc",
19 'duration': "Duration - Asc",
20 '-duration': "Duration - Desc",
21 'createdDate': "Created Date - Asc",
22 '-createdDate': "Created Date - Desc"
23 }
24
25 get choiceKeys() {
26 return Object.keys(this.sortChoices);
27 }
28
29 getStringChoice(choiceKey: SortField): string {
30 return this.sortChoices[choiceKey];
31 }
32
33 onSortChange() {
34 this.sort.emit(this.currentSort);
35 }
36}