]>
Commit | Line | Data |
---|---|---|
41a2aee3 | 1 | import { Component, EventEmitter, Input, Output } from '@angular/core'; |
cf20596c | 2 | |
4a6995be | 3 | import { SortField } from '../shared'; |
cf20596c C |
4 | |
5 | @Component({ | |
6 | selector: 'my-video-sort', | |
4a6995be | 7 | template: require('./video-sort.component.html') |
cf20596c C |
8 | }) |
9 | ||
10 | export class VideoSortComponent { | |
11 | @Output() sort = new EventEmitter<any>(); | |
12 | ||
13 | @Input() currentSort: SortField; | |
14 | ||
15 | sortChoices = { | |
16 | 'name': 'Name - Asc', | |
aff038cd C |
17 | '-name': 'Name - Desc', |
18 | 'duration': 'Duration - Asc', | |
19 | '-duration': 'Duration - Desc', | |
20 | 'createdDate': 'Created Date - Asc', | |
21 | '-createdDate': 'Created Date - Desc' | |
22 | }; | |
cf20596c C |
23 | |
24 | get choiceKeys() { | |
25 | return Object.keys(this.sortChoices); | |
26 | } | |
27 | ||
ccf6ed16 | 28 | getStringChoice(choiceKey: SortField) { |
cf20596c C |
29 | return this.sortChoices[choiceKey]; |
30 | } | |
31 | ||
32 | onSortChange() { | |
33 | this.sort.emit(this.currentSort); | |
34 | } | |
35 | } |