aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search/search.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-10-01 17:21:03 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-10-01 17:23:06 +0200
commitc5d04b4f3543bd1e5b07773b191f58c520edf205 (patch)
tree8612c68f08925f90a72de492a01934af628b887e /client/src/app/search/search.component.ts
parent99cc653f47a5db664ec119e66a84c8f6454eed0b (diff)
downloadPeerTube-c5d04b4f3543bd1e5b07773b191f58c520edf205.tar.gz
PeerTube-c5d04b4f3543bd1e5b07773b191f58c520edf205.tar.zst
PeerTube-c5d04b4f3543bd1e5b07773b191f58c520edf205.zip
add allow advancedSearch with empty search
a.k.a. filters on all videos also added a badge showing the rough number of active filters
Diffstat (limited to 'client/src/app/search/search.component.ts')
-rw-r--r--client/src/app/search/search.component.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index 475fdd277..b86b5083a 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -30,7 +30,7 @@ export class SearchComponent implements OnInit, OnDestroy {
30 currentSearch: string 30 currentSearch: string
31 31
32 private subActivatedRoute: Subscription 32 private subActivatedRoute: Subscription
33 private isInitialLoad = true 33 private isInitialLoad = false // set to false to show the search filters on first arrival
34 private firstSearch = true 34 private firstSearch = true
35 35
36 private channelsPerPage = 2 36 private channelsPerPage = 2
@@ -137,6 +137,10 @@ export class SearchComponent implements OnInit, OnDestroy {
137 this.updateUrlFromAdvancedSearch() 137 this.updateUrlFromAdvancedSearch()
138 } 138 }
139 139
140 numberOfFilters () {
141 return this.advancedSearch.size()
142 }
143
140 private resetPagination () { 144 private resetPagination () {
141 this.pagination.currentPage = 1 145 this.pagination.currentPage = 1
142 this.pagination.totalItems = null 146 this.pagination.totalItems = null
@@ -150,9 +154,11 @@ export class SearchComponent implements OnInit, OnDestroy {
150 } 154 }
151 155
152 private updateUrlFromAdvancedSearch () { 156 private updateUrlFromAdvancedSearch () {
157 const search = (this.currentSearch && this.currentSearch !== '') ? this.currentSearch : undefined
158
153 this.router.navigate([], { 159 this.router.navigate([], {
154 relativeTo: this.route, 160 relativeTo: this.route,
155 queryParams: Object.assign({}, this.advancedSearch.toUrlObject(), { search: this.currentSearch }) 161 queryParams: Object.assign({}, this.advancedSearch.toUrlObject(), { search })
156 }) 162 })
157 } 163 }
158} 164}