Preserve query parameters when switching to fullscreen view.

pull/3563/head
Tim Habermaas 9 years ago committed by Stefan Botzenhart
parent f89bd45095
commit 4b810e40e7
  1. 2
      frontend/app/templates/work_packages.show.html
  2. 1
      frontend/app/work_packages/controllers/index.js
  3. 21
      frontend/app/work_packages/controllers/work-package-show-controller.js
  4. 7
      frontend/app/work_packages/controllers/work-packages-list-controller.js

@ -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() }">
<i class="icon-table-view button--icon"></i>
</button>

@ -112,6 +112,7 @@ angular.module('openproject.workPackages.controllers')
.controller('WorkPackageShowController', [
'$scope',
'$state',
'$location',
'latestTab',
'workPackage',
'I18n',

@ -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) {

@ -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});
}
};

Loading…
Cancel
Save