Roberto Sánchez
2014-01-17 04afd774aecc70dca37559fdd8b9a716829c18cd
securis/src/main/resources/static/js/admin.js
....@@ -33,7 +33,9 @@
3333 '$http',
3434 'toaster',
3535 'Catalogs',
36
- function($scope, $http, toaster, Catalogs) {
36
+ '$store',
37
+ '$L',
38
+ function($scope, $http, toaster, Catalogs, $store, $L) {
3739 $scope.showForm = false;
3840 $scope.isNew = false;
3941 $scope.formu = {};
....@@ -78,16 +80,16 @@
7880 }
7981
8082 $scope.delete = function(data) {
81
- BootstrapDialog.confirm('The record will be deleted, are you sure?', function(result){
83
+ BootstrapDialog.confirm($L.get('The record will be deleted, are you sure?'), function(result){
8284 if(result) {
8385 var promise = Catalogs.remove(data).$promise;
8486 promise.then(function(data) {
8587 $scope.list = Catalogs.query();
8688 Catalogs.refreshRef($scope.refs, Catalogs.getMetadata().resource, $scope.list);
87
- toaster.pop('success', Catalogs.getName(), "Element deleted successfully");
89
+ toaster.pop('success', Catalogs.getName(), $L.get("Element deleted successfully"));
8890 },function(error) {
8991 console.log(error);
90
- toaster.pop('error', Catalogs.getName(), "Error deleting element, reason: " + HTTP_ERRORS[error.status] + ". Details: " + error.headers('X-SECURIS-ERROR'), 10000);
92
+ 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);
9193 });
9294 }
9395 });
....@@ -136,7 +138,7 @@
136138
137139 $scope.saveCatalog = function() {
138140 if ($scope.catalogForm.$invalid) {
139
- toaster.pop('error', Catalogs.getName(), "There are wrong data in current form, please fix it before to save");
141
+ toaster.pop('error', Catalogs.getName(), $L.get("There are wrong data in current form, please fix it before to save"));
140142 } else {
141143 var promise = Catalogs.save($scope.formu).$promise;
142144 promise.then(function(data, otro) {
....@@ -150,10 +152,10 @@
150152 $scope.$parent.list = Catalogs.query();
151153 Catalogs.refreshRef($scope.refs, Catalogs.getMetadata().resource, $scope.$parent.list);
152154
153
- toaster.pop('success', Catalogs.getName(), "Element saved successfully");
155
+ toaster.pop('success', Catalogs.getName(), $L.get("Element saved successfully"));
154156 }, function(error) {
155157 console.log(error);
156
- toaster.pop('error', Catalogs.getName(), "Error saving element, reason: " + HTTP_ERRORS[error.status] + ". Details: " + error.headers('X-SECURIS-ERROR'), 10000);
158
+ 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);
157159 });
158160
159161 }