LP#1402797 Focus patron search field on search, expand, clear
authorMike Rylander <mrylander@gmail.com>
Fri, 12 Dec 2014 21:41:24 +0000 (16:41 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 12 Feb 2015 16:58:27 +0000 (11:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/circ/patron/t_search.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 29abb40..b2034f9 100644 (file)
             ng-model="searchArgs.second_given_name" placeholder="[% l('Middle Name') %]"/>
         </div>
 
-        <div class="col-md-2">
+        <div class="col-md-2" onmouseover="window.prevElement=document.activeElement">
           <input type="submit" class="btn btn-default" value="[% l('Search') %]"/>
         </div>
 
-        <div class="col-md-2">
-          <input type="reset" class="btn btn-default" ng-click="searchArgs={}
+        <div class="col-md-2" onmouseover="window.prevElement=document.activeElement">
+          <input type="reset" class="btn btn-default" ng-click="clearForm()
             value="[% l('Clear Form') %]"/>
         </div>
 
         <div class="col-md-2">
           <button class="btn btn-default" ng-click="applyShowExtras($event, true)" 
+            onmouseover="window.prevElement=document.activeElement"
             title="[% l('Show More Fields') %]" ng-show="!showExtras">
             <span class="glyphicon glyphicon-circle-arrow-down"></span>
           </button>
           <button class="btn btn-default" ng-click="applyShowExtras($event, false)" 
+            onmouseover="window.prevElement=document.activeElement"
             title="[% l('Show Fewer Fields') %]" ng-show="showExtras">
             <span class="glyphicon glyphicon-circle-arrow-up"></span>
           </button>
index 49d1e24..14d699c 100644 (file)
@@ -884,6 +884,11 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
         return d;
     }
 
+    $scope.clearForm = function () {
+        $scope.searchArgs={};
+        window.prevElement.focus();
+    }
+
     $scope.applyShowExtras = function($event, bool) {
         if (bool) {
             $scope.showExtras = true;
@@ -892,6 +897,7 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
             $scope.showExtras = false;
             egCore.hatch.removeItem('eg.circ.patron.search.show_extras');
         }
+        window.prevElement.focus();
         $event.preventDefault();
     }