Feature #3116 Mini panel para el Learning path - Refactoring

skala
Alberto Torreblanca 15 years ago
parent e832cd85be
commit 3238629ca4
  1. 43
      main/inc/lib/javascript/jquery.lp_minipanel.js

@ -1,4 +1,3 @@
/*******************************************
Learning Path minipanel - Chamilo 1.8.8
Adding mini panel to browse Learning Paths
@ -10,10 +9,9 @@
$(document).ready(function() {
//Adding div to hide panel
$('#learning_path_right_zone').
before('<div id="hide_bar" style="float: left; width: 10px; height: 100%;">' +
'<table style="border: 0px none; width: 100%; height: 100%; cursor: pointer; background-color: #EEEEEE">' +
'<table style="border: 0 none; width: 100%; height: 100%; cursor: pointer; background-color: #EEEEEE">' +
'<tr> <td> </td></tr></table></div>');
$('#hide_bar table').css({backgroundImage: "url(../img/hide0.png)", backgroundRepeat: "no-repeat", backgroundPosition: "center center"})
@ -31,14 +29,12 @@
}
);
//Adding funcionality
// Adding funcionality
$('#hide_bar table').toggle(function(){
var panel = $('#lp_navigation_elem div:first').clone();
// Copy little progress bar in <tr></tr>
function minipb(){
$('#learning_path_main #control tr').after('<tr></tr>');
$('#learning_path_main #control tr').after('<tr></tr>');
$('#learning_path_main #control tr:eq(1)').append($('#progress_bar').html());
$('#learning_path_main #control tr:eq(1) #progress_img_limit_left').attr('height','5');
$('#learning_path_main #control tr:eq(1) #progress_img_full').attr('height','5');
@ -49,17 +45,12 @@
$('#learning_path_main #control tr:eq(1) div').css('width','');
}
// Construct mini panel
var panel = $('#lp_navigation_elem div:first').clone();
$(panel).attr('id','control');
$('#learning_path_main').append(panel);
minipb();
$('#learning_path_main #control .buttons').attr('align','center');
$('#learning_path_left_zone').hide(50);
$('#learning_path_right_zone').css('marginLeft','10px');
$('#hide_bar table').css('backgroundImage','url(../img/hide2.png)').css('backgroundColor','#EEEEEE');
$('#learning_path_main #control').css(
{ margin: "auto",
width: "132px",
@ -74,21 +65,27 @@
borderRadius: "4px 4px 4px 4px",
opacity: "0.8",
cursor: "move"
}
);
});
$('#learning_path_main #control table').attr('align','center');
$('#learning_path_main #control').draggable({ iframeFix: true, stack: "#learning_path_right_zone", cursor: "move" });
$('#learning_path_main #control .buttons img').click(function(){
$('#learning_path_main #control tr:eq(1)').remove();
$('#learning_path_main #control').draggable(
{ iframeFix: true,
stack: "#learning_path_right_zone",
cursor: "move"
});
$('#learning_path_main #control .buttons img').click(function()
{ $('#learning_path_main #control tr:eq(1)').remove();
minipb();
});
// Hiding navigation left zone
$('#learning_path_left_zone').hide(50).css('marginLeft','10px');
$('#hide_bar table').css('backgroundImage','url(../img/hide2.png)').css('backgroundColor','#EEEEEE');
},function(){
// Show navigation left zone
$('#hide_bar table').css('backgroundImage','url(../img/hide0.png)').css('backgroundColor','#EEEEEE');
$('#learning_path_right_zone').css('marginLeft','290px');
$('#learning_path_left_zone').show(50);
$('#learning_path_main #control').remove();
});
});
})(jQuery);
})(jQuery);
Loading…
Cancel
Save