[23715] Keep current project context as stateParam

This adds a global projectPath parameter to the router configuration,
which allows us to keep the current project context without explicitly
specifying it as a parameter.

We do not have frontend movements outside the project context without a
hard refresh. Should that come, one simply has to explictly specify
`projectPath: null` to the route request.
pull/4935/head
Oliver Günther 8 years ago
parent 6e62083200
commit 822afabcbd
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 21
      frontend/app/components/routing/ui-router.config.ts

@ -95,6 +95,12 @@ openprojectModule
.state('work-packages', { .state('work-packages', {
url: '', url: '',
abstract: true, abstract: true,
params: {
// value: null makes the parameter optional
// squash: true avoids duplicate slashes when the paramter is not provided
projectPath: {value: null, squash: true},
projects: {value: null, squash: true},
},
templateUrl: '/components/routing/main/work-packages.html', templateUrl: '/components/routing/main/work-packages.html',
controller: 'WorkPackagesController' controller: 'WorkPackagesController'
}) })
@ -107,12 +113,6 @@ openprojectModule
reloadOnSearch: false, reloadOnSearch: false,
onEnter: () => angular.element('body').addClass('full-create'), onEnter: () => angular.element('body').addClass('full-create'),
onExit: () => angular.element('body').removeClass('full-create'), onExit: () => angular.element('body').removeClass('full-create'),
params: {
// value: null makes the parameter optional
// squash: true avoids duplicate slashes when the paramter is not provided
projectPath: {value: null, squash: true},
projects: {value: null, squash: true}
}
}) })
.state('work-packages.copy', { .state('work-packages.copy', {
@ -128,11 +128,6 @@ openprojectModule
.state('work-packages.edit', { .state('work-packages.edit', {
url: '/{projects}/{projectPath}/work_packages/{workPackageId:[0-9]+}/edit', url: '/{projects}/{projectPath}/work_packages/{workPackageId:[0-9]+}/edit',
params: {
projectPath: {value: null, squash: true},
projects: {value: null, squash: true},
},
onEnter: ($state, $timeout, $stateParams, wpEditModeState:WorkPackageEditModeStateService) => { onEnter: ($state, $timeout, $stateParams, wpEditModeState:WorkPackageEditModeStateService) => {
wpEditModeState.start(); wpEditModeState.start();
// Transitioning to a new state may cause a reported issue // Transitioning to a new state may cause a reported issue
@ -143,7 +138,7 @@ openprojectModule
}) })
.state('work-packages.show', { .state('work-packages.show', {
url: '/work_packages/{workPackageId:[0-9]+}?query_id&query_props', url: '/work_packages/{workPackageId:[0-9]+}',
templateUrl: '/components/routing/wp-show/wp.show.html', templateUrl: '/components/routing/wp-show/wp.show.html',
controller: 'WorkPackageShowController', controller: 'WorkPackageShowController',
controllerAs: '$ctrl', controllerAs: '$ctrl',
@ -173,8 +168,6 @@ openprojectModule
params: { params: {
// value: null makes the parameter optional // value: null makes the parameter optional
// squash: true avoids duplicate slashes when the paramter is not provided // squash: true avoids duplicate slashes when the paramter is not provided
projectPath: {value: null, squash: true},
projects: {value: null, squash: true},
query_id: {value: null}, query_id: {value: null},
query_props: {value: null} query_props: {value: null}
}, },

Loading…
Cancel
Save