aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/app/videos/video-list/video-sort.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/app/videos/video-list/video-sort.component.ts')
-rw-r--r--client/app/videos/video-list/video-sort.component.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/client/app/videos/video-list/video-sort.component.ts b/client/app/videos/video-list/video-sort.component.ts
new file mode 100644
index 000000000..d00d7ed49
--- /dev/null
+++ b/client/app/videos/video-list/video-sort.component.ts
@@ -0,0 +1,36 @@
1import { Component, EventEmitter, Input, Output } from '@angular/core';
2
3import { SortField } from '../shared/index';
4
5@Component({
6 selector: 'my-video-sort',
7 // styleUrls: [ 'app/angular/videos/components/list/video-sort.component.css' ],
8 templateUrl: 'client/app/videos/video-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}