]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/app/videos/video-list/video-sort.component.ts
Do not prefix private attributes
[github/Chocobozzz/PeerTube.git] / client / app / videos / video-list / video-sort.component.ts
1 import { Component, EventEmitter, Input, Output } from '@angular/core';
2
3 import { 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
11 export 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) {
30 return this.sortChoices[choiceKey];
31 }
32
33 onSortChange() {
34 this.sort.emit(this.currentSort);
35 }
36 }