diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-02-26 14:08:09 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-06 10:03:19 +0200 |
commit | 8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4 (patch) | |
tree | b1d2ed65c602a9a295aa3c4359f1eb705b79278a /client | |
parent | 6a882428e11f924db2ae8ff188df11a42eaaec46 (diff) | |
download | PeerTube-8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4.tar.gz PeerTube-8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4.tar.zst PeerTube-8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4.zip |
add sort select to my videos, change default sort to -publishedAt
fixes #3779
Diffstat (limited to 'client')
3 files changed, 21 insertions, 1 deletions
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.html b/client/src/app/+my-library/my-videos/my-videos.component.html index 6e6bf12f4..b0d49efa2 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.html +++ b/client/src/app/+my-library/my-videos/my-videos.component.html | |||
@@ -25,6 +25,17 @@ | |||
25 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetSearch()"></a> | 25 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetSearch()"></a> |
26 | <span class="sr-only" i18n>Clear filters</span> | 26 | <span class="sr-only" i18n>Clear filters</span> |
27 | </div> | 27 | </div> |
28 | |||
29 | <div class="peertube-select-container peertube-select-button ml-2"> | ||
30 | <select [(ngModel)]="sort" (ngModelChange)="onChangeSortColumn()" class="form-control"> | ||
31 | <option value="undefined" disabled>Sort by</option> | ||
32 | <option value="-publishedAt" i18n>Last published first</option> | ||
33 | <option value="-createdAt" i18n>Last created first</option> | ||
34 | <option value="-views" i18n>Most viewed first</option> | ||
35 | <option value="-likes" i18n>Most liked first</option> | ||
36 | <option value="-duration" i18n>Longest first</option> | ||
37 | </select> | ||
38 | </div> | ||
28 | </div> | 39 | </div> |
29 | 40 | ||
30 | <my-videos-selection | 41 | <my-videos-selection |
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.scss b/client/src/app/+my-library/my-videos/my-videos.component.scss index a03baa056..b10f8b0ab 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.scss +++ b/client/src/app/+my-library/my-videos/my-videos.component.scss | |||
@@ -5,6 +5,10 @@ input[type=text] { | |||
5 | @include peertube-input-text(300px); | 5 | @include peertube-input-text(300px); |
6 | } | 6 | } |
7 | 7 | ||
8 | .peertube-select-container { | ||
9 | @include peertube-select-container(auto); | ||
10 | } | ||
11 | |||
8 | h1 { | 12 | h1 { |
9 | display: flex; | 13 | display: flex; |
10 | justify-content: space-between; | 14 | justify-content: space-between; |
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts index 0bc923e73..d6e66e617 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.ts +++ b/client/src/app/+my-library/my-videos/my-videos.component.ts | |||
@@ -43,6 +43,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
43 | videosSearch: string | 43 | videosSearch: string |
44 | videosSearchChanged = new Subject<string>() | 44 | videosSearchChanged = new Subject<string>() |
45 | getVideosObservableFunction = this.getVideosObservable.bind(this) | 45 | getVideosObservableFunction = this.getVideosObservable.bind(this) |
46 | sort: VideoSortField = '-publishedAt' | ||
46 | 47 | ||
47 | user: User | 48 | user: User |
48 | 49 | ||
@@ -80,6 +81,10 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
80 | this.videosSearchChanged.next() | 81 | this.videosSearchChanged.next() |
81 | } | 82 | } |
82 | 83 | ||
84 | onChangeSortColumn () { | ||
85 | this.videosSelection.reloadVideos() | ||
86 | } | ||
87 | |||
83 | disableForReuse () { | 88 | disableForReuse () { |
84 | this.videosSelection.disableForReuse() | 89 | this.videosSelection.disableForReuse() |
85 | } | 90 | } |
@@ -91,7 +96,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook { | |||
91 | getVideosObservable (page: number, sort: VideoSortField) { | 96 | getVideosObservable (page: number, sort: VideoSortField) { |
92 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 97 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
93 | 98 | ||
94 | return this.videoService.getMyVideos(newPagination, sort, this.videosSearch) | 99 | return this.videoService.getMyVideos(newPagination, this.sort, this.videosSearch) |
95 | .pipe( | 100 | .pipe( |
96 | tap(res => this.pagination.totalItems = res.total) | 101 | tap(res => this.pagination.totalItems = res.total) |
97 | ) | 102 | ) |