LP#1706124: Make include inactive patrons checkbox sticky
authorKathy Lussier <klussier@masslnc.org>
Wed, 13 Sep 2017 17:07:29 +0000 (13:07 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 20 Sep 2017 00:37:37 +0000 (20:37 -0400)
The state of the 'include inactive' checkbox on the patron search page will now
be remembered when users return to the page. Many thanks to Cesar Velez,
whose code for bug 1697754 inspired this patch!

Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
Open-ILS/web/js/ui/default/staff/services/patron_search.js

index 816076c..d84a2f8 100644 (file)
         <div class="col-md-2">
           <div class="checkbox">
             <label>
         <div class="col-md-2">
           <div class="checkbox">
             <label>
-              <input type="checkbox" ng-model="searchArgs.inactive"/>
+              <input type="checkbox" ng-model="searchArgs.inactive" ng-change="onSearchInactiveChanged()"/>
               [% l('Include Inactive?') %]
             </label>
           </div>
               [% l('Include Inactive?') %]
             </label>
           </div>
index c27274f..7897671 100644 (file)
@@ -745,7 +745,17 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
     egCore.hatch.getItem('eg.circ.patron.search.show_extras')
     .then(function(val) {$scope.showExtras = val});
 
     egCore.hatch.getItem('eg.circ.patron.search.show_extras')
     .then(function(val) {$scope.showExtras = val});
 
-    // map form arguments into search params
+// check searchArgs.inactive setting
+    egCore.hatch.getItem('searchArgs.inactive')
+                .then(function(searchInactive){
+                    if (searchInactive) $scope.searchArgs.inactive = searchInactive; 
+                });    
+
+     $scope.onSearchInactiveChanged = function(){
+        egCore.hatch.setItem('searchArgs.inactive', $scope.searchArgs.inactive);
+    }
+
+// map form arguments into search params
     function compileSearch(args) {
         var search = {};
         angular.forEach(args, function(val, key) {
     function compileSearch(args) {
         var search = {};
         angular.forEach(args, function(val, key) {