diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
commit | 4a6995be18b15de1834a39c8921a0e4109671bb6 (patch) | |
tree | b659661cea33687fcc6bd8fc2251cb7a15ab9f9d /client/src/app/videos/video-list/video-sort.component.ts | |
parent | 468892541175f9662f8b1b977e819dc1a496f282 (diff) | |
download | PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.gz PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.zst PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.zip |
First draft to use webpack instead of systemjs
Diffstat (limited to 'client/src/app/videos/video-list/video-sort.component.ts')
-rw-r--r-- | client/src/app/videos/video-list/video-sort.component.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/client/src/app/videos/video-list/video-sort.component.ts b/client/src/app/videos/video-list/video-sort.component.ts new file mode 100644 index 000000000..0d76b54b7 --- /dev/null +++ b/client/src/app/videos/video-list/video-sort.component.ts | |||
@@ -0,0 +1,35 @@ | |||
1 | import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
2 | |||
3 | import { SortField } from '../shared'; | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-video-sort', | ||
7 | template: require('./video-sort.component.html') | ||
8 | }) | ||
9 | |||
10 | export class VideoSortComponent { | ||
11 | @Output() sort = new EventEmitter<any>(); | ||
12 | |||
13 | @Input() currentSort: SortField; | ||
14 | |||
15 | sortChoices = { | ||
16 | 'name': 'Name - Asc', | ||
17 | '-name': 'Name - Desc', | ||
18 | 'duration': 'Duration - Asc', | ||
19 | '-duration': 'Duration - Desc', | ||
20 | 'createdDate': 'Created Date - Asc', | ||
21 | '-createdDate': 'Created Date - Desc' | ||
22 | }; | ||
23 | |||
24 | get choiceKeys() { | ||
25 | return Object.keys(this.sortChoices); | ||
26 | } | ||
27 | |||
28 | getStringChoice(choiceKey: SortField) { | ||
29 | return this.sortChoices[choiceKey]; | ||
30 | } | ||
31 | |||
32 | onSortChange() { | ||
33 | this.sort.emit(this.currentSort); | ||
34 | } | ||
35 | } | ||