From b3e431ce85b4fe39132523e6fd90b70829eb71a4 Mon Sep 17 00:00:00 2001 From: Tim Habermaas Date: Sun, 16 Aug 2015 19:19:02 +0200 Subject: [PATCH] Fix buttons for switching between views on WorkPackage show page. --- frontend/app/templates/work_packages.show.html | 8 ++++---- .../controllers/work-package-show-controller.js | 8 ++++++++ .../work_packages/controllers/work-packages-controller.js | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/app/templates/work_packages.show.html b/frontend/app/templates/work_packages.show.html index b01ae7cf38..0f3ce1d940 100644 --- a/frontend/app/templates/work_packages.show.html +++ b/frontend/app/templates/work_packages.show.html @@ -21,11 +21,11 @@ {{ getActivationActionLabel(isDetailsViewActive()) + ' ' + I18n.t('js.button_list_view') }} @@ -40,7 +40,7 @@ class="button" title="{{ getActivationActionLabel(!isDetailsViewActive()) + ' ' + I18n.t('js.button_details_view') }}" ng-class="{ '-active': isDetailsViewActive() }" - ng-click="openLatestTab()"> + ng-click="showWorkPackageDetails()"> 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 99e90948bc..71c4cfd392 100644 --- a/frontend/app/work_packages/controllers/work-package-show-controller.js +++ b/frontend/app/work_packages/controllers/work-package-show-controller.js @@ -193,6 +193,14 @@ module.exports = function($scope, hideAllAttributes: true }; + $scope.showWorkPackageDetails = function() { + $state.go('work-packages.list.details.overview', {workPackageId: $scope.workPackage.props.id}); + }; + + $scope.closeDetailsView = function() { + $state.go('work-packages.list'); + }; + function getFocusAnchorLabel(tab, workPackage) { var tabLabel = I18n.t('js.work_packages.tabs.' + tab), params = { diff --git a/frontend/app/work_packages/controllers/work-packages-controller.js b/frontend/app/work_packages/controllers/work-packages-controller.js index d10519d9af..db490d0ab1 100644 --- a/frontend/app/work_packages/controllers/work-packages-controller.js +++ b/frontend/app/work_packages/controllers/work-packages-controller.js @@ -49,6 +49,10 @@ module.exports = function($scope, $state, $stateParams, QueryService, PathHelper return $state.includes('work-packages.list.details'); }; + $scope.isListViewActive = function() { + return $state.is('work-packages.list'); + }; + $scope.isShowViewActive = function() { return $state.includes('work-packages.show'); };