webstaff: add session-stickiness for MARC template selector
authorGalen Charlton <gmc@esilibrary.com>
Thu, 8 Oct 2015 01:10:35 +0000 (01:10 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:50 +0000 (14:58 -0500)
The new bib function now remembers the last MARC template
that was used for the lifetime of the browser tab.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index 63d01df..9418804 100644 (file)
@@ -190,9 +190,12 @@ function($scope , $routeParams , $location , $window , $q , egCore) {
         });
         $scope.template_list.sort();
     });
-    egCore.hatch.getItem('cat.default_bib_marc_template').then(function(template) {
-        $scope.template_name = template;
-    });
+    $scope.template_name = egCore.hatch.getSessionItem('eg.cat.last_bib_marc_template');
+    if (!$scope.template_name) {
+        egCore.hatch.getItem('cat.default_bib_marc_template').then(function(template) {
+            $scope.template_name = template;
+        });
+    }
 
     $scope.loadTemplate = function() {
         if ($scope.template_name) {
@@ -203,6 +206,7 @@ function($scope , $routeParams , $location , $window , $q , egCore) {
             ).then(function(template) {
                 $scope.marc_template = template;
                 $scope.have_template = true;
+                egCore.hatch.setSessionItem('eg.cat.last_bib_marc_template', $scope.template_name);
             });
         }
     }