lp1773995 web client: xul copy template conversion collab/phasefx/lp1773995-xul-copy-template-conversion-propagation
authorJason Etheridge <jason@EquinoxInitiative.org>
Fri, 23 Aug 2019 13:25:12 +0000 (09:25 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Tue, 10 Sep 2019 19:32:21 +0000 (15:32 -0400)
does not immediately propagate xul templates to templates tab

Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 6813258..2134bc4 100644 (file)
@@ -284,14 +284,19 @@ function(egCore , $q) {
     service.get_acp_templates = function() {
         // Already downloaded for this user? Return local copy. Changing users or logging out causes another download
         // so users always have their own templates, and any changes made on other machines appear as expected.
+        // The setSessionItem cat.copy.templates.user lines can be disabled for debugging to force a re-download and
+        // translation of test templates.  Alternately, use this in the console:
+        // window.sessionStorage.removeItem('cat.copy.templates.usr');
         if (egCore.hatch.getSessionItem('cat.copy.templates.usr') == egCore.auth.user().id()) {
             return egCore.hatch.getItem('cat.copy.templates').then(function(templ) {
+                egCore.hatch.setSessionItem('cat.copy.templates.usr', egCore.auth.user().id());
                 return templ;
             });
         } else {
-            // this can be disabled for debugging to force a re-download and translation of test templates
-            egCore.hatch.setSessionItem('cat.copy.templates.usr', egCore.auth.user().id());
-            return service.load_remote_acp_templates();
+            return service.load_remote_acp_templates().then(function(templ) {
+                egCore.hatch.setSessionItem('cat.copy.templates.usr', egCore.auth.user().id());
+                return templ;
+            });
         }
 
     };
@@ -2418,7 +2423,6 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                         }
                     });
                 }
-                $scope.fetchTemplates();
             
                 $scope.applyTemplate = function (n) {
                     angular.forEach($scope.templates[n], function (v,k) {
@@ -2481,6 +2485,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                 $scope.imported_templates = { data : '' };
                 $scope.template_name = '';
                 $scope.template_name_list = [];
+                $scope.fetchTemplates();
 
                 $scope.$watch('imported_templates.data', function(newVal, oldVal) {
                     if (newVal && newVal != oldVal) {