From 2a4293a36d9030ea8e01931dd7e52322836d1c33 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 4 Apr 2012 14:50:38 +0200 Subject: [PATCH] Skills: when clicking a skill element it load their parents and their children (blocks are not organized yet) --- main/inc/lib/javascript/skills.js | 22 +++++++++------------- main/template/default/skill/skill_tree.tpl | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/main/inc/lib/javascript/skills.js b/main/inc/lib/javascript/skills.js index 9ba0a54187..161e92a638 100644 --- a/main/inc/lib/javascript/skills.js +++ b/main/inc/lib/javascript/skills.js @@ -88,17 +88,14 @@ function open_parent(parent_id, id) { load_parent(numeric_parent_id, numeric_id); } - function open_block_student(id) { open_block(id, 1) } -/* - * +/* * When clicking a children block @param string block id i.e "block_1" - @param int load user data or not - + @param int load user data or not */ function open_block(id, load_user_data) { if (debug) console.log("open_block id : " + id+" load_user_data: " +load_user_data); @@ -261,17 +258,16 @@ 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; - - $('body').append('
'+item.name+'
'); - var es = prepare("block_" + item.id, editEndpoint); - var es2 = prepare("block_" + id, editEndpoint); + /*left_value = center_x + space_between_blocks_x * ix; + top_value = offset_y;*/ + $('body').append('
'+item.name+'
'); + jsPlumb.connect({ - source: es, target:es2 + source: 'block_'+parent_id, target:'block_'+id }); - jsPlumb.animate("block_" + item.id, { left: left_value, top : top_value }, { duration : duration_value}); + + //jsPlumb.animate("block_" + item.id, { left: left_value, top : top_value }, { duration : duration_value}); if (item.parent_id) { if (debug) console.log('setting first_parent '+item.parent_id); diff --git a/main/template/default/skill/skill_tree.tpl b/main/template/default/skill/skill_tree.tpl index ecb6a614d2..20c9ea97bd 100644 --- a/main/template/default/skill/skill_tree.tpl +++ b/main/template/default/skill/skill_tree.tpl @@ -148,7 +148,7 @@ jsPlumb.ready(function() { parents = [id]; } - if (parents[1] != id) { + if (parents[1] != id) { console.log('parents.length ' +parents.length); if (parents.length == 2 ) { @@ -173,11 +173,11 @@ jsPlumb.ready(function() { } if ($(this).hasClass('first_window')) { - console.log('first_window'); + console.log('im in a first_window (root)'); //show the first_parent //if (first_parent != '') { parents = [first_parent, id]; - // console.log(parents); + console.log(parents); open_parent(first_parent, id); //} }