From 04afd774aecc70dca37559fdd8b9a716829c18cd Mon Sep 17 00:00:00 2001
From: Roberto Sánchez <roberto.sanchez@curisit.net>
Date: Fri, 17 Jan 2014 12:27:16 +0000
Subject: [PATCH] #396 feature - Added LocalStorage support and http interceptor for unauthorized access

---
 securis/src/main/resources/static/js/admin.js |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/securis/src/main/resources/static/js/admin.js b/securis/src/main/resources/static/js/admin.js
index 6d806ac..fc1857a 100644
--- a/securis/src/main/resources/static/js/admin.js
+++ b/securis/src/main/resources/static/js/admin.js
@@ -33,7 +33,9 @@
 			'$http',
 			'toaster',
 			'Catalogs',
-			function($scope, $http, toaster, Catalogs) {
+			'$store',
+			'$L',
+			function($scope, $http, toaster, Catalogs, $store, $L) {
 				$scope.showForm = false;
 				$scope.isNew = false;
 				$scope.formu = {};
@@ -78,16 +80,16 @@
 				}
 
 				$scope.delete = function(data) {
-					BootstrapDialog.confirm('The record will be deleted, are you sure?', function(result){
+					BootstrapDialog.confirm($L.get('The record will be deleted, are you sure?'), function(result){
 			            if(result) {
 							var promise = Catalogs.remove(data).$promise;
 							promise.then(function(data) {
 								$scope.list = Catalogs.query();
 								Catalogs.refreshRef($scope.refs, Catalogs.getMetadata().resource, $scope.list);
-								toaster.pop('success', Catalogs.getName(), "Element deleted successfully");
+								toaster.pop('success', Catalogs.getName(), $L.get("Element deleted successfully"));
 							},function(error) {
 								console.log(error);
-								toaster.pop('error', Catalogs.getName(), "Error deleting element, reason: " + HTTP_ERRORS[error.status] + ". Details: " + error.headers('X-SECURIS-ERROR'), 10000);
+								toaster.pop('error', Catalogs.getName(), $L.get("Error deleting element, reason: {0}. Details: {1}", $L.get(HTTP_ERRORS[error.status]), error.headers('X-SECURIS-ERROR')), 10000);
 							});
 			            }
 			        });
@@ -136,7 +138,7 @@
 
 				$scope.saveCatalog = function() {
 					if ($scope.catalogForm.$invalid) {
-						toaster.pop('error', Catalogs.getName(), "There are wrong data in current form, please fix it before to save");
+						toaster.pop('error', Catalogs.getName(), $L.get("There are wrong data in current form, please fix it before to save"));
 					} else {
 						var promise = Catalogs.save($scope.formu).$promise;
 						promise.then(function(data, otro) {
@@ -150,10 +152,10 @@
 							$scope.$parent.list = Catalogs.query();
 							Catalogs.refreshRef($scope.refs, Catalogs.getMetadata().resource, $scope.$parent.list);
 
-							toaster.pop('success', Catalogs.getName(), "Element saved successfully");
+							toaster.pop('success', Catalogs.getName(), $L.get("Element saved successfully"));
 						}, function(error) {
 							console.log(error);
-							toaster.pop('error', Catalogs.getName(), "Error saving element, reason: " + HTTP_ERRORS[error.status] + ". Details: " + error.headers('X-SECURIS-ERROR'), 10000);
+							toaster.pop('error', Catalogs.getName(), $L.get("Error saving element, reason: {0}. Details: {1}", $L.get(HTTP_ERRORS[error.status]), error.headers('X-SECURIS-ERROR')), 10000);
 						});
 						
 					}

--
Gitblit v1.3.2