From 4b11fba6c4ef7b4f15c6bf823dbfa7db570c8510 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 24 Oct 2018 14:38:01 -0400 Subject: [PATCH] LP#1724348 Honor default tab from catalog search The default tab selection was not being honored from catalog searches, as the search had already set $scope.record_tab, and we were honoring that value in all cases. Instead, let's honor that value in cases where the OPAC load doesn't change our current record, which should only happen if we load the record directly to a non-opac tab, then go to the OPAC view. To test: 1) Set any tab other than "OPAC View" as your default view in record details. 2) Do a catalog search. 3) Select a record, and notice your default view is not set. 4) Apply patch, do the same steps, and notice the default view is now selected. To test regression of bug #1708951: 1) In Firefox, load a record directly (e.g. /eg/opac/staff/cat/catalog/record/123). 2) Note the default view loaded. 3) Click "OPAC View". 4) Note the view does not return to your default view, but stays on the OPAC. Signed-off-by: Dan Wells Signed-off-by: Jason Boyer --- Open-ILS/web/js/ui/default/staff/cat/catalog/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 43af4d568d..45057161b1 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -581,6 +581,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e return; } + var prev_record_id = $scope.record_id; var match = url.match(/\/+opac\/+record\/+(\d+)/); if (match) { $scope.record_id = match[1]; @@ -606,8 +607,10 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e // child scope is executing this function, so our digest doesn't fire ... thus, $scope.$apply(); - if (!$scope.in_opac_call) { - if ($scope.record_id && !$scope.record_tab) { + // don't change tabs if we are using the OPAC nav buttons, + // or we didn't change records on the OPAC load + if (!$scope.in_opac_call && ($scope.record_id != prev_record_id)) { + if ($scope.record_id) { $scope.default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' ); tab = $routeParams.record_tab || $scope.default_tab || 'catalog'; } else { -- 2.43.2