Remember tab when navigating back to split screen

pull/7112/head
Henriette Dinger 6 years ago
parent e166420b08
commit a4e7548ae9
  1. 11
      frontend/src/app/modules/common/back-routing/back-routing.service.ts
  2. 4
      frontend/src/app/modules/router/openproject.routes.ts

@ -28,23 +28,30 @@
import {Injectable, Injector} from '@angular/core';
import {StateService} from "@uirouter/core";
import {KeepTabService} from "core-components/wp-single-view-tabs/keep-tab/keep-tab.service";
interface BackRouteOptions {
name:string;
params: {};
params:{};
parent:string;
}
@Injectable()
export class BackRoutingService {
public backRoute:BackRouteOptions;
private $state:StateService = this.injector.get(StateService);
private keepTab:KeepTabService = this.injector.get(KeepTabService);
constructor(protected injector:Injector) {
}
public goBack() {
if (this.backRoute) {
this.$state.go(this.backRoute.name, this.backRoute.params);
if(this.backRoute.parent === 'work-packages.list.details') {
this.$state.go(this.keepTab.currentDetailsState, this.$state.params);
} else {
this.$state.go(this.backRoute.name, this.backRoute.params);
}
} else {
this.$state.go('work-packages.list', this.$state.params);
}

@ -140,8 +140,8 @@ export function initializeUiRouterListeners(injector:Injector) {
fromState.data &&
toState.data &&
fromState.data.parent !== toState.data.parent) {
const paramsFromCopy = Object.assign({}, transition.params('from'));
backRoutingService.setBackRoute({ name: fromState.name, params: paramsFromCopy });
const paramsFromCopy = Object.assign({}, transition.params('from'));
backRoutingService.setBackRoute({ name: fromState.name, params: paramsFromCopy, parent: fromState.data.parent });
}
// Reset profiler, if we're actually profiling

Loading…
Cancel
Save