mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°309 - Afficher les arbres pliés ou dépliés
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
animated ?
|
||||
this.animate({ height: "toggle" }, animated, callback) :
|
||||
this.each(function(){
|
||||
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
|
||||
$(this)[ $(this).is(":hidden") ? "show" : "hide" ]();
|
||||
if(callback)
|
||||
callback.apply(this, arguments);
|
||||
});
|
||||
@@ -52,6 +52,32 @@
|
||||
this.each(callback);
|
||||
}
|
||||
},
|
||||
heightToggleShow: function(animated, callback) {
|
||||
if (animated) {
|
||||
this.animate({ height: "show" }, animated, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.each(function() {
|
||||
$(this).show();
|
||||
if (callback)
|
||||
callback.apply(this, arguments);
|
||||
});
|
||||
}
|
||||
},
|
||||
heightToggleHide: function(animated, callback) {
|
||||
if (animated) {
|
||||
this.animate({ height: "hide" }, animated, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.each(function() {
|
||||
$(this).hide();
|
||||
if (callback)
|
||||
callback.apply(this, arguments);
|
||||
});
|
||||
}
|
||||
},
|
||||
prepareBranches: function(settings) {
|
||||
if (!settings.prerendered) {
|
||||
// mark last tree items
|
||||
@@ -132,20 +158,42 @@
|
||||
|
||||
// handle toggle event
|
||||
function toggler() {
|
||||
//with if it's better
|
||||
if($(this).parent().find(".treeview").first().is(":hidden") )
|
||||
{
|
||||
$(this)
|
||||
.parent()
|
||||
// swap classes for hitarea
|
||||
.find(">.hitarea")
|
||||
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
|
||||
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
|
||||
.replaceClass( CLASSES.expandableHitarea, CLASSES.collapsableHitarea)
|
||||
.replaceClass( CLASSES.lastExpandableHitarea, CLASSES.lastCollapsableHitarea)
|
||||
.end()
|
||||
// swap classes for parent li
|
||||
.swapClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
.replaceClass( CLASSES.expandable, CLASSES.collapsable )
|
||||
.replaceClass( CLASSES.lastExpandable, CLASSES.lastCollapsable )
|
||||
// find child lists
|
||||
.find( ">ul" )
|
||||
// toggle them
|
||||
.heightToggle( settings.animated, settings.toggle );
|
||||
.heightToggleShow( settings.animated, settings.toggle );
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this)
|
||||
.parent()
|
||||
// swap classes for hitarea
|
||||
.find(">.hitarea")
|
||||
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
|
||||
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
|
||||
.end()
|
||||
// swap classes for parent li
|
||||
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
// find child lists
|
||||
.find( ">ul" )
|
||||
// toggle them
|
||||
.heightToggleHide( settings.animated, settings.toggle );
|
||||
}
|
||||
|
||||
if ( settings.unique ) {
|
||||
$(this).parent()
|
||||
.siblings()
|
||||
@@ -160,7 +208,6 @@
|
||||
.heightHide( settings.animated, settings.toggle );
|
||||
}
|
||||
}
|
||||
|
||||
function serialize() {
|
||||
function binary(arg) {
|
||||
return arg ? 1 : 0;
|
||||
|
||||
Reference in New Issue
Block a user