From 23e43a2193d68606f83fa9fc44c91e75aa778843 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 12 Mar 2015 10:39:08 -0400 Subject: [PATCH] webstaff: Do not change the tab on iframe changes when using the summary bar buttons Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../web/js/ui/default/staff/cat/catalog/app.js | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 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 64d4efda09..0648d756ab 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 @@ -130,9 +130,11 @@ function($scope , $routeParams , $location , $q , egCore , egHolds, // will hold a ref to the opac iframe $scope.opac_iframe = null; + $scope.in_opac_call = false; $scope.opac_call = function (opac_frame_function, force_opac_tab) { if ($scope.opac_iframe) { if (force_opac_tab) $scope.record_tab = 'catalog'; + $scope.in_opac_call = true; $scope.opac_iframe.contentWindow[opac_frame_function](); } } @@ -166,21 +168,24 @@ function($scope , $routeParams , $location , $q , egCore , egHolds, if (match) { $scope.record_id = match[1]; egCore.hatch.setLocalItem("eg.cat.last_record_retrieved", $scope.record_id); - - // force the record_id to show up in the page. - // not sure why a $digest isn't occuring here. - try { $scope.$apply() } catch(E) {} } else { delete $scope.record_id; } - if ($scope.record_id) { - var default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' ); - tab = $routeParams.record_tab || default_tab || 'catalog'; + // child scope is executing this function, so our digest doesn't fire ... thus, + $scope.$apply(); + + if (!$scope.in_opac_call) { + if ($scope.record_id) { + var default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' ); + tab = $routeParams.record_tab || default_tab || 'catalog'; + } else { + tab = $routeParams.record_tab || 'catalog'; + } + $scope.set_record_tab(tab); } else { - tab = $routeParams.record_tab || 'catalog'; + $scope.in_opac_call = false; } - $scope.set_record_tab(tab); } // xulG catalog handlers -- 2.11.0