diff --git a/frontend/app/templates/work_packages.show.html b/frontend/app/templates/work_packages.show.html index 70e4c35830..56886ed649 100644 --- a/frontend/app/templates/work_packages.show.html +++ b/frontend/app/templates/work_packages.show.html @@ -25,7 +25,7 @@ accesskey="{{ isListViewActive() ? '' : '8' }}" class="button" title="{{ getActivationActionLabel(!isListViewActive()) + ' ' + I18n.t('js.button_list_view') }}" - ng-click="closeDetailsView()" + ng-click="closeShowView()" ng-class="{ '-active': isListViewActive() }"> diff --git a/frontend/app/work_packages/controllers/index.js b/frontend/app/work_packages/controllers/index.js index c9e7b9cc54..493b0044cf 100644 --- a/frontend/app/work_packages/controllers/index.js +++ b/frontend/app/work_packages/controllers/index.js @@ -112,6 +112,7 @@ angular.module('openproject.workPackages.controllers') .controller('WorkPackageShowController', [ '$scope', '$state', + '$location', 'latestTab', 'workPackage', 'I18n', diff --git a/frontend/app/work_packages/controllers/work-package-show-controller.js b/frontend/app/work_packages/controllers/work-package-show-controller.js index 85a3332285..8be3a30487 100644 --- a/frontend/app/work_packages/controllers/work-package-show-controller.js +++ b/frontend/app/work_packages/controllers/work-package-show-controller.js @@ -28,6 +28,7 @@ module.exports = function($scope, $state, + $location, latestTab, workPackage, I18n, @@ -194,12 +195,26 @@ module.exports = function($scope, hideAllAttributes: true }; + function projectPathForWorkPackage() { + return PathHelper.staticBase + '/projects/' + $scope.projectIdentifier; + } + $scope.showWorkPackageDetails = function() { - $state.go('work-packages.list.details.overview', {workPackageId: $scope.workPackage.props.id, projectPath: PathHelper.staticBase + '/projects/' + $scope.projectIdentifier}); + var queryProps = $location.search()['query_props'], + path = $state.href('work-packages.list.details.overview', {projectPath: projectPathForWorkPackage(), + workPackageId: $scope.workPackage.props.id + }); + // Using $location.url instead of $state.go because query_props is not defined + // in the router. See work-packages-list-controller.js for more explanation. + $location.url(path).search('query_props', queryProps); }; - $scope.closeDetailsView = function() { - $state.go('work-packages.list', {projectPath: PathHelper.staticBase + '/projects/' + $scope.projectIdentifier}); + $scope.closeShowView = function() { + var queryProps = $location.search()['query_props'], + path = $state.href('work-packages.list', {projectPath: projectPathForWorkPackage()}); + // Using $location.url instead of $state.go because query_props is not defined + // in the router. See work-packages-list-controller.js for more explanation. + $location.url(path).search('query_props', queryProps); }; function getFocusAnchorLabel(tab, workPackage) { diff --git a/frontend/app/work_packages/controllers/work-packages-list-controller.js b/frontend/app/work_packages/controllers/work-packages-list-controller.js index b3b4237425..80958428f1 100644 --- a/frontend/app/work_packages/controllers/work-packages-list-controller.js +++ b/frontend/app/work_packages/controllers/work-packages-list-controller.js @@ -306,11 +306,12 @@ module.exports = function($scope, $rootScope, $state, $stateParams, $location, l }; $scope.showWorkPackageShowView = function() { - var id = $state.params.workPackageId; + var id = $state.params.workPackageId, + queryProps = $location.search()['query_props']; if (id) { - $state.go('work-packages.show.activity', {workPackageId: id}); + $state.go('work-packages.show.activity', {workPackageId: id, 'query_props': queryProps}); } else { - $state.go('work-packages.show.activity', {workPackageId: $scope.preselectedWorkPackageId}); + $state.go('work-packages.show.activity', {workPackageId: $scope.preselectedWorkPackageId, 'query_props': queryProps}); } };