From: Bill Erickson Date: Fri, 2 Jan 2015 16:21:43 +0000 (-0500) Subject: LP1402797 patron search form focus repairs cont. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fcollab%2Fberick%2Flp1402797-patron-search-focus;p=working%2FEvergreen.git LP1402797 patron search form focus repairs cont. Building on Mike's original work, use Angular ng-mouseover and the Angular $document built-in. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 index b2034f98cf..bc4e92af19 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 @@ -26,23 +26,23 @@ ng-model="searchArgs.second_given_name" placeholder="[% l('Middle Name') %]"/> -
+
-
+
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 1e05b7d850..e1580bce46 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -687,9 +687,9 @@ function($scope , $location , egCore , egConfirmDialog , egUser , patronSvc) { */ .controller('PatronSearchCtrl', ['$scope','$q','$routeParams','$timeout','$window','$location','egCore', - '$filter','egUser', 'patronSvc','egGridDataProvider', + '$filter','egUser', 'patronSvc','egGridDataProvider','$document', function($scope, $q, $routeParams, $timeout, $window, $location, egCore, - $filter, egUser, patronSvc , egGridDataProvider) { + $filter, egUser, patronSvc , egGridDataProvider , $document) { $scope.initTab('search'); $scope.focusMe = true; @@ -698,6 +698,9 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, home_ou : egCore.org.tree() }; + // last used patron search form element + var lastFormElement; + $scope.gridControls = { activateItem : function(item) { $location.path('/circ/patron/' + item.id() + '/checkout'); @@ -857,7 +860,7 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, $scope.clearForm = function () { $scope.searchArgs={}; - window.prevElement.focus(); + if (lastFormElement) lastFormElement.focus(); } $scope.applyShowExtras = function($event, bool) { @@ -868,7 +871,7 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, $scope.showExtras = false; egCore.hatch.removeItem('eg.circ.patron.search.show_extras'); } - window.prevElement.focus(); + if (lastFormElement) lastFormElement.focus(); $event.preventDefault(); } @@ -931,12 +934,16 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, return sort; } + $scope.setLastFormElement = function() { + lastFormElement = $document[0].activeElement; + } + // search form submit action; tells the results grid to // refresh itself. $scope.search = function(args) { // args === $scope.searchArgs if (args && Object.keys(args).length) $scope.gridControls.refresh(); - window.prevElement.focus(); + if (lastFormElement) lastFormElement.focus(); } // TODO: move this into the (forthcoming) grid row activate action