From fb1b6755a9ecd43601dc4fbef9166d11d8a86f24 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Tue, 14 Oct 2014 16:25:10 +0000
Subject: [PATCH] #2021 config - Added application Metadata management

---
 securis/src/main/resources/static/js/admin.js |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/securis/src/main/resources/static/js/admin.js b/securis/src/main/resources/static/js/admin.js
index a9850fe..a433436 100644
--- a/securis/src/main/resources/static/js/admin.js
+++ b/securis/src/main/resources/static/js/admin.js
@@ -7,6 +7,7 @@
             401: "Unathorized action",
             403: "Forbidden action",
 			500: "Server error",
+			418: "Application error",
 			404: "Element not found"
 	}
 	
@@ -21,9 +22,9 @@
 							link : function(scope, element, attrs, ngModel) {
 								if (!ngModel)
 									return; // do nothing if no ng-model
-								// TODO: Replace the hard-coded form ID by the
+								// TODO: Replace the hard-coded form ID ('catalogForm') by the
 								// appropiate dynamic field
-								scope.catalogForm[attrs.name] = scope.catalogForm['{{field.name}}'];
+								scope.catalogForm[attrs.name] = scope.catalogForm[scope.field.name];
 								scope.catalogForm[attrs.name].$name = attrs.name;
 							}
 						};
@@ -115,6 +116,8 @@
 						return 'select';
 					if (field.type === 'multiselect')
 						return 'multiselect';
+					if (field.type === 'metadata')
+						return 'metadata';
 					if (!field.multiline)
 						return 'normal';
 					if (field.multiline)
@@ -161,6 +164,19 @@
 						
 					}
 				}
+				
+				// Metadata management
+				
+				$scope.createMetadataRow = function() {
+					if (!$scope.formu.metadata) {
+						$scope.formu.metadata = [];
+					}
+					$scope.formu.metadata.push({key: '', value: '', mandatory: true});
+				}
+				$scope.removeMetadataKey = function(row_md) {
+					$scope.formu.metadata.splice( $scope.formu.metadata.indexOf(row_md), 1 );
+				}
+				
 			} ]);
 
 	app.controller('CatalogListCtrl', [ '$scope', '$http', '$filter', 'Catalogs', 

--
Gitblit v1.3.2