# HG changeset patch # User cavaliet # Date 1378744892 -7200 # Node ID 3a8a5513118022b0e5162f86483684b7eb8a2eb3 # Parent 5f6edd450863007bde07af56061b35afc855e8ea clean and debug diff -r 5f6edd450863 -r 3a8a55131180 src/p4l/static/p4l/js/p4l.js --- a/src/p4l/static/p4l/js/p4l.js Mon Sep 09 18:01:47 2013 +0200 +++ b/src/p4l/static/p4l/js/p4l.js Mon Sep 09 18:41:32 2013 +0200 @@ -54,10 +54,6 @@ $scope.record.$save({recordId: context.record_id}); } - $scope.addUriToList = function(list, uri) { - list.push(uri); - }; - $scope.removeFromList = function(uri, list) { i = list.indexOf(uri); if(i>=0){ @@ -82,15 +78,15 @@ replace: true, transclude: true, scope: { - localid:"@", - listname:"@" + listname:"@", + list:"=", }, templateUrl: function(tElement, tAttrs) { return context.urls.base_static+'p4l/templates/addSemanticUriForm.html'; }, link: function($scope, $element, $attrs) { // Get queries attributes from $scope listname and context query dict - attr_dict = context[$scope.listname + "_query_dict"]; + attr_dict = context.query_dicts[$scope.listname]; for (var k in attr_dict){ if (attr_dict.hasOwnProperty(k)) { $scope[k] = attr_dict[k]; @@ -98,7 +94,7 @@ } // initalize autocomplete and browse thesaurus events init_autocomplete(); - // We have to apply because init_browse needs the real ids and not {{ localid }} + // We have to apply because init_browse needs the real ids and not {{ $id }} $scope.$apply(); init_browse(); }, @@ -108,7 +104,7 @@ $scope.addUriText = ''; $scope.addUriToList = function() { - $scope.record[$scope.listname].push($scope.addUriText); + $scope.list.push($scope.addUriText); $scope.addUriText = ''; }; diff -r 5f6edd450863 -r 3a8a55131180 src/p4l/static/p4l/js/semantictree.js --- a/src/p4l/static/p4l/js/semantictree.js Mon Sep 09 18:01:47 2013 +0200 +++ b/src/p4l/static/p4l/js/semantictree.js Mon Sep 09 18:41:32 2013 +0200 @@ -125,7 +125,7 @@ "title" : b[i]["label"]["value"] + " (" + nb + ") " }, "state" : "closed", - "metadata" : {uri: "<" + uri + ">", label:b[i]["label"]["value"]} + "metadata" : {uri: "<"+uri+">", label:b[i]["label"]["value"]} //"language" : "en" }); } @@ -134,7 +134,7 @@ "data" : { "title" : b[i]["label"]["value"] }, - "metadata" : {uri: "<" + uri + ">", label:b[i]["label"]["value"]} + "metadata" : {uri: "<"+uri+">", label:b[i]["label"]["value"]} }); } } @@ -147,10 +147,6 @@ }, progressive_render: true }, - ui : { - select_limit: 1, - initially_select: $('#thesaurus_tree').val()?['node-term-'+$('#thesaurus_tree').val()]:[] - }, plugins : [ "themes", "json_data", "ui"] }); }, @@ -177,6 +173,9 @@ else{ // First we update the uri/label dict uri = selected_node.data('uri'); + // We remove the <> from the uri + uri = uri.substring(1); + uri = uri.substring(0, uri.length - 1); label = selected_node.data('label'); angular.element($('#id_'+input_name)[0]).scope().updateUriLabelDict(uri, label); // Angular does not listen to val() event so we update the model value manually: diff -r 5f6edd450863 -r 3a8a55131180 src/p4l/static/p4l/templates/addSemanticUriForm.html --- a/src/p4l/static/p4l/templates/addSemanticUriForm.html Mon Sep 09 18:01:47 2013 +0200 +++ b/src/p4l/static/p4l/templates/addSemanticUriForm.html Mon Sep 09 18:41:32 2013 +0200 @@ -1,13 +1,13 @@