Skills: when clicking a skill element it load their parents and their children (blocks are not organized yet)

skala
Julio Montoya 13 years ago
parent 72f3dd93d6
commit 2a4293a36d
  1. 22
      main/inc/lib/javascript/skills.js
  2. 6
      main/template/default/skill/skill_tree.tpl

@ -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('<div id="block_'+item.id+ '" class="open_block window " >'+item.name+'</div>');
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('<div id="block_'+item.id+ '" class="open_block skill_root first_window " >'+item.name+'</div>');
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);

@ -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);
//}
}

Loading…
Cancel
Save