From 394dac7fc4cedfb1894f50acfcd6a31af5906486 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 4 Apr 2012 17:53:50 +0200 Subject: [PATCH] Skills more fixes, it's working but it's ugly (elements are not ordered but they're connected) --- main/inc/lib/javascript/skills.js | 34 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/main/inc/lib/javascript/skills.js b/main/inc/lib/javascript/skills.js index 8b4f1d925d..f72c5fe554 100644 --- a/main/inc/lib/javascript/skills.js +++ b/main/inc/lib/javascript/skills.js @@ -239,7 +239,7 @@ function load_children(my_id, top_value, load_user_data, create_root) { }); jsPlumb.draggable(jsPlumb.getSelector(".skill_child")); - //jsPlumb.draggable(jsPlumb.getSelector(".skill_root")); + jsPlumb.draggable(jsPlumb.getSelector(".skill_root")); console.log('draggable'); @@ -275,24 +275,26 @@ function load_parent(parent_id, id) { var json = jQuery.parseJSON(json); $.each(json,function(i,item) { - /*left_value = center_x + space_between_blocks_x * ix; - top_value = offset_y;*/ + if (item.parent_id == 0) { - $('body').append('
'+item.name+'
'); - - jsPlumb.connect({ - source: 'block_'+parent_id, target:'block_'+id - }); - - //jsPlumb.animate("block_" + item.id, { left: left_value, top : top_value }, { duration : duration_value}); + $('#skill_tree').append('
'+item.name+'
'); - if (item.parent_id) { - if (debug) console.log('setting first_parent '+item.parent_id); - first_parent = "block_" + item.parent_id; + jsPlumb.connect({ + source: 'block_'+parent_id, target:'block_'+id + }); + + if (debug) console.log('setting NO--- first_parent '); + first_parent = ''; } else { - if (debug) console.log('setting NO--- first_parent '); - } - ix++; + $('#skill_tree').append('
'+item.name+'
'); + + jsPlumb.connect({ + source: 'block_'+parent_id, target:'block_'+id + }); + + if (debug) console.log('setting first_parent '+item.parent_id); + first_parent = "block_" + item.parent_id; + } }); } });