rsanchez
2014-10-15 973ee9056995d1c9e7a533d9999329a70f0d2b2d
securis/src/main/resources/static/js/admin.js
....@@ -66,7 +66,7 @@
6666 $scope.edit = function(data) {
6767 $scope.showForm = true;
6868 $scope.isNew = false;
69
- // Next line is a wirkaround due to some issues with values with ID == 0
69
+ // Next line is a workaround due to some issues with values with ID == 0
7070 $('select').val(null);
7171 $scope.formu = {}
7272 var fields = Catalogs.getMetadata().fields;
....@@ -130,6 +130,10 @@
130130 $scope.$parent.showForm = true;
131131 $('select').val(null);
132132 $scope.$parent.formu = {};
133
+
134
+ console.log("Refs:");
135
+ console.log($scope.refs);
136
+
133137 setTimeout(function() {
134138 $('#'+Catalogs.getFFF()).focus();
135139 }, 0);
....@@ -165,6 +169,11 @@
165169 }
166170 }
167171
172
+ $scope.selectFieldChanged = function(onchangehandler) {
173
+ if (onchangehandler) {
174
+ $scope[onchangehandler]();
175
+ }
176
+ }
168177 // Metadata management
169178
170179 $scope.createMetadataRow = function() {
....@@ -176,6 +185,14 @@
176185 $scope.removeMetadataKey = function(row_md) {
177186 $scope.formu.metadata.splice( $scope.formu.metadata.indexOf(row_md), 1 );
178187 }
188
+ $scope.updateMetadata = function() {
189
+ // Called when Application ID change in current field
190
+ var newAppId = $scope.formu['application_id'];
191
+ console.log('Ready to get metadata from application: ' + newAppId);
192
+ Catalogs.getResource('application').get({appId: newAppId}).$promise.then(function(app) {
193
+ $scope.formu.metadata = app.metadata;
194
+ });
195
+ }
179196
180197 } ]);
181198