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;
+ });
}
};
}
});
}
- $scope.fetchTemplates();
$scope.applyTemplate = function (n) {
angular.forEach($scope.templates[n], function (v,k) {
$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) {