rsanchez
2014-10-14 fb1b6755a9ecd43601dc4fbef9166d11d8a86f24
securis/src/main/resources/static/js/admin.js
....@@ -7,6 +7,7 @@
77 401: "Unathorized action",
88 403: "Forbidden action",
99 500: "Server error",
10
+ 418: "Application error",
1011 404: "Element not found"
1112 }
1213
....@@ -21,9 +22,9 @@
2122 link : function(scope, element, attrs, ngModel) {
2223 if (!ngModel)
2324 return; // do nothing if no ng-model
24
- // TODO: Replace the hard-coded form ID by the
25
+ // TODO: Replace the hard-coded form ID ('catalogForm') by the
2526 // appropiate dynamic field
26
- scope.catalogForm[attrs.name] = scope.catalogForm['{{field.name}}'];
27
+ scope.catalogForm[attrs.name] = scope.catalogForm[scope.field.name];
2728 scope.catalogForm[attrs.name].$name = attrs.name;
2829 }
2930 };
....@@ -115,6 +116,8 @@
115116 return 'select';
116117 if (field.type === 'multiselect')
117118 return 'multiselect';
119
+ if (field.type === 'metadata')
120
+ return 'metadata';
118121 if (!field.multiline)
119122 return 'normal';
120123 if (field.multiline)
....@@ -161,6 +164,19 @@
161164
162165 }
163166 }
167
+
168
+ // Metadata management
169
+
170
+ $scope.createMetadataRow = function() {
171
+ if (!$scope.formu.metadata) {
172
+ $scope.formu.metadata = [];
173
+ }
174
+ $scope.formu.metadata.push({key: '', value: '', mandatory: true});
175
+ }
176
+ $scope.removeMetadataKey = function(row_md) {
177
+ $scope.formu.metadata.splice( $scope.formu.metadata.indexOf(row_md), 1 );
178
+ }
179
+
164180 } ]);
165181
166182 app.controller('CatalogListCtrl', [ '$scope', '$http', '$filter', 'Catalogs',