src/p4l/static/p4l/js/p4l.js
changeset 111 e2ecb345b58f
parent 88 1753fcef095a
child 112 ba6056f58516
--- a/src/p4l/static/p4l/js/p4l.js	Fri Sep 20 11:43:49 2013 +0200
+++ b/src/p4l/static/p4l/js/p4l.js	Fri Sep 20 12:54:55 2013 +0200
@@ -14,12 +14,12 @@
                 save:{
                     method:"PUT",
                     isArray:false,
-                    headers:{'X-CSRFToken':context.csrf_token} 
+                    headers:{'X-CSRFToken':context.csrf_token}
                 } 
             });
 });
 
-app.service("RecordModel", function(Api, context) {    
+app.service("RecordModel", function(Api, context) {
     this.record = Api.record.get({recordId: context.record_id});
     this.uriLabels = context.uri_labels;
 });
@@ -193,6 +193,7 @@
 	    $scope.record = RecordModel.record;
 	    $scope.uriLabels = RecordModel.uriLabels;
 	    $scope.addUriText = '';
+	    $scope.uriInDict = false;
 	    
 	    $scope.addUriToList = function() {
 	    	$scope.list.push($scope.addUriText);
@@ -208,6 +209,9 @@
 	    $scope.updateUriLabelDict = function(k,v) {
 	        $scope.uriLabels[k] = v;
 	    };
+	    $scope.$watch("addUriText", function(newValue, oldValue){
+	    	$scope.uriInDict = (($scope.dataquery!='') && ($scope.addUriText in $scope.uriLabels));
+	    });
       }
     }
 });
@@ -246,6 +250,7 @@
             $scope.record = RecordModel.record;
             $scope.uriLabels = RecordModel.uriLabels;
             $scope.addUriText = '';
+    	    $scope.uriInDict = false;
 
             $scope.updateVal = function() {
                 $scope.val = $scope.addUriText;
@@ -254,6 +259,9 @@
             $scope.updateUriLabelDict = function(k,v) {
                 $scope.uriLabels[k] = v;
             };
+            $scope.$watch("addUriText", function(newValue, oldValue){
+    	    	$scope.uriInDict = (($scope.dataquery!='') && ($scope.addUriText in $scope.uriLabels));
+    	    });
         }
     };
 });