aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-20 14:27:30 +0200
committerChocobozzz <me@florianbigard.com>2018-04-20 14:27:30 +0200
commit2a2c19dfef7a9aa313c6ca0798f271c9a63449a9 (patch)
treee6c87798105b64fc5dc44705532965cc6c96bd06
parent6d492e562cdc80d986323e9b5ee14953d3956e18 (diff)
downloadPeerTube-2a2c19dfef7a9aa313c6ca0798f271c9a63449a9.tar.gz
PeerTube-2a2c19dfef7a9aa313c6ca0798f271c9a63449a9.tar.zst
PeerTube-2a2c19dfef7a9aa313c6ca0798f271c9a63449a9.zip
Replace current state when changing page
-rw-r--r--client/src/app/account/account-videos/account-videos.component.ts2
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts8
-rw-r--r--client/src/app/videos/video-list/video-local.component.ts2
-rw-r--r--client/src/app/videos/video-list/video-recently-added.component.ts2
-rw-r--r--client/src/app/videos/video-list/video-search.component.ts2
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts2
6 files changed, 16 insertions, 2 deletions
diff --git a/client/src/app/account/account-videos/account-videos.component.ts b/client/src/app/account/account-videos/account-videos.component.ts
index 07f5b7f0b..91bc1b695 100644
--- a/client/src/app/account/account-videos/account-videos.component.ts
+++ b/client/src/app/account/account-videos/account-videos.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnInit, OnDestroy } from '@angular/core' 1import { Component, OnInit, OnDestroy } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
3import { immutableAssign } from '@app/shared/misc/utils' 4import { immutableAssign } from '@app/shared/misc/utils'
4import { ComponentPagination } from '@app/shared/rest/component-pagination.model' 5import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
5import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
@@ -35,6 +36,7 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
35 protected authService: AuthService, 36 protected authService: AuthService,
36 protected notificationsService: NotificationsService, 37 protected notificationsService: NotificationsService,
37 protected confirmService: ConfirmService, 38 protected confirmService: ConfirmService,
39 protected location: Location,
38 private videoService: VideoService) { 40 private videoService: VideoService) {
39 super() 41 super()
40 } 42 }
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 7f2cf2d7e..728c864e9 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -1,5 +1,6 @@
1import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core' 1import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
3import { isInMobileView } from '@app/shared/misc/utils' 4import { isInMobileView } from '@app/shared/misc/utils'
4import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' 5import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive'
5import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
@@ -40,6 +41,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
40 protected abstract authService: AuthService 41 protected abstract authService: AuthService
41 protected abstract router: Router 42 protected abstract router: Router
42 protected abstract route: ActivatedRoute 43 protected abstract route: ActivatedRoute
44 protected abstract location: Location
43 protected abstract currentRoute: string 45 protected abstract currentRoute: string
44 abstract titlePage: string 46 abstract titlePage: string
45 47
@@ -164,8 +166,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
164 } 166 }
165 167
166 protected setNewRouteParams () { 168 protected setNewRouteParams () {
167 const routeParams = this.buildRouteParams() 169 const paramsObject = this.buildRouteParams()
168 this.router.navigate([ this.currentRoute ], { queryParams: routeParams }) 170
171 const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&')
172 this.location.replaceState(this.currentRoute, queryParams)
169 } 173 }
170 174
171 protected buildVideoPages () { 175 protected buildVideoPages () {
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts
index de6552875..fd67be67b 100644
--- a/client/src/app/videos/video-list/video-local.component.ts
+++ b/client/src/app/videos/video-list/video-local.component.ts
@@ -1,6 +1,7 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { immutableAssign } from '@app/shared/misc/utils'
4import { Location } from '@angular/common'
4import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth' 6import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list' 7import { AbstractVideoList } from '../../shared/video/abstract-video-list'
@@ -23,6 +24,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
23 protected route: ActivatedRoute, 24 protected route: ActivatedRoute,
24 protected notificationsService: NotificationsService, 25 protected notificationsService: NotificationsService,
25 protected authService: AuthService, 26 protected authService: AuthService,
27 protected location: Location,
26 private videoService: VideoService) { 28 private videoService: VideoService) {
27 super() 29 super()
28 } 30 }
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts
index cca35d0f5..535b6e618 100644
--- a/client/src/app/videos/video-list/video-recently-added.component.ts
+++ b/client/src/app/videos/video-list/video-recently-added.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
3import { immutableAssign } from '@app/shared/misc/utils' 4import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth' 6import { AuthService } from '../../core/auth'
@@ -19,6 +20,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
19 20
20 constructor (protected router: Router, 21 constructor (protected router: Router,
21 protected route: ActivatedRoute, 22 protected route: ActivatedRoute,
23 protected location: Location,
22 protected notificationsService: NotificationsService, 24 protected notificationsService: NotificationsService,
23 protected authService: AuthService, 25 protected authService: AuthService,
24 private videoService: VideoService) { 26 private videoService: VideoService) {
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts
index 46a9dd48e..774d81ed6 100644
--- a/client/src/app/videos/video-list/video-search.component.ts
+++ b/client/src/app/videos/video-list/video-search.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
3import { RedirectService } from '@app/core' 4import { RedirectService } from '@app/core'
4import { immutableAssign } from '@app/shared/misc/utils' 5import { immutableAssign } from '@app/shared/misc/utils'
5import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
@@ -27,6 +28,7 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
27 protected route: ActivatedRoute, 28 protected route: ActivatedRoute,
28 protected notificationsService: NotificationsService, 29 protected notificationsService: NotificationsService,
29 protected authService: AuthService, 30 protected authService: AuthService,
31 protected location: Location,
30 private videoService: VideoService, 32 private videoService: VideoService,
31 private redirectService: RedirectService 33 private redirectService: RedirectService
32 ) { 34 ) {
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts
index 0c9e28216..ea65070f9 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
3import { immutableAssign } from '@app/shared/misc/utils' 4import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth' 6import { AuthService } from '../../core/auth'
@@ -21,6 +22,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
21 protected route: ActivatedRoute, 22 protected route: ActivatedRoute,
22 protected notificationsService: NotificationsService, 23 protected notificationsService: NotificationsService,
23 protected authService: AuthService, 24 protected authService: AuthService,
25 protected location: Location,
24 private videoService: VideoService) { 26 private videoService: VideoService) {
25 super() 27 super()
26 } 28 }