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