| .. | .. |
|---|
| 7 | 7 | 401: "Unathorized action", |
|---|
| 8 | 8 | 403: "Forbidden action", |
|---|
| 9 | 9 | 500: "Server error", |
|---|
| 10 | + 418: "Application error", |
|---|
| 10 | 11 | 404: "Element not found" |
|---|
| 11 | 12 | } |
|---|
| 12 | 13 | |
|---|
| .. | .. |
|---|
| 21 | 22 | link : function(scope, element, attrs, ngModel) { |
|---|
| 22 | 23 | if (!ngModel) |
|---|
| 23 | 24 | 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 |
|---|
| 25 | 26 | // appropiate dynamic field |
|---|
| 26 | | - scope.catalogForm[attrs.name] = scope.catalogForm['{{field.name}}']; |
|---|
| 27 | + scope.catalogForm[attrs.name] = scope.catalogForm[scope.field.name]; |
|---|
| 27 | 28 | scope.catalogForm[attrs.name].$name = attrs.name; |
|---|
| 28 | 29 | } |
|---|
| 29 | 30 | }; |
|---|
| .. | .. |
|---|
| 115 | 116 | return 'select'; |
|---|
| 116 | 117 | if (field.type === 'multiselect') |
|---|
| 117 | 118 | return 'multiselect'; |
|---|
| 119 | + if (field.type === 'metadata') |
|---|
| 120 | + return 'metadata'; |
|---|
| 118 | 121 | if (!field.multiline) |
|---|
| 119 | 122 | return 'normal'; |
|---|
| 120 | 123 | if (field.multiline) |
|---|
| .. | .. |
|---|
| 161 | 164 | |
|---|
| 162 | 165 | } |
|---|
| 163 | 166 | } |
|---|
| 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 | + |
|---|
| 164 | 180 | } ]); |
|---|
| 165 | 181 | |
|---|
| 166 | 182 | app.controller('CatalogListCtrl', [ '$scope', '$http', '$filter', 'Catalogs', |
|---|