From 86e83939869976e9b4dfa6dc9d3785a284bd598c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Mar 2017 21:52:25 +0100 Subject: Allow to sort by likes --- client/src/app/videos/shared/sort-field.type.ts | 5 ++++- client/src/app/videos/video-list/video-list.component.ts | 1 - client/src/app/videos/video-list/video-sort.component.ts | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'client') diff --git a/client/src/app/videos/shared/sort-field.type.ts b/client/src/app/videos/shared/sort-field.type.ts index 7bda3112a..6cc598d8b 100644 --- a/client/src/app/videos/shared/sort-field.type.ts +++ b/client/src/app/videos/shared/sort-field.type.ts @@ -1,3 +1,6 @@ export type SortField = 'name' | '-name' | 'duration' | '-duration' - | 'createdAt' | '-createdAt'; + | 'createdAt' | '-createdAt' + | 'views' | '-views' + | 'likes' | '-likes'; + diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts index 844e14567..ede1b51a9 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts @@ -18,7 +18,6 @@ import { SearchService } from '../../shared'; styleUrls: [ './video-list.component.scss' ], templateUrl: './video-list.component.html' }) - export class VideoListComponent implements OnInit, OnDestroy { loading: BehaviorSubject = new BehaviorSubject(false); pagination: RestPagination = { diff --git a/client/src/app/videos/video-list/video-sort.component.ts b/client/src/app/videos/video-list/video-sort.component.ts index c950fa8aa..cde307f2f 100644 --- a/client/src/app/videos/video-list/video-sort.component.ts +++ b/client/src/app/videos/video-list/video-sort.component.ts @@ -12,7 +12,7 @@ export class VideoSortComponent { @Input() currentSort: SortField; - sortChoices = { + sortChoices: { [ id: SortField ]: string } = { 'name': 'Name - Asc', '-name': 'Name - Desc', 'duration': 'Duration - Asc', @@ -20,7 +20,9 @@ export class VideoSortComponent { 'createdAt': 'Created Date - Asc', '-createdAt': 'Created Date - Desc', 'views': 'Views - Asc', - '-views': 'Views - Desc' + '-views': 'Views - Desc', + 'likes': 'Likes - Asc', + '-likes': 'Likes - Desc' }; get choiceKeys() { -- cgit v1.2.3