- Bug fix: support resizable elements inside tabs.

SVN:trunk[999]
This commit is contained in:
Denis Flaven
2010-11-30 14:54:03 +00:00
parent dfe3ced440
commit 06bb4a4f03

View File

@@ -169,6 +169,39 @@ class iTopWebPage extends NiceWebPage
$("tbody tr.green_even:odd",table).removeClass('even').removeClass('green_even').addClass('green');
}
});
$('.resizable').resizable(); // Make resizable everything that claims to be resizable !
// Adjust initial size
$('.v-resizable').each( function()
{
var parent_id = $(this).parent().id;
// Restore the saved height
var iHeight = GetUserPreference(parent_id+'_'+this.id+'_height', undefined);
if (iHeight != undefined)
{
$(this).height(parseInt(iHeight, 10)); // Parse in base 10 !);
}
// Adjust the child 'item''s height and width to fit
var container = $(this);
var fixedWidth = container.parent().innerWidth() - 6;
// Set the width to fit the parent
$(this).width(fixedWidth);
var headerHeight = $(this).find('.drag_handle').height();
// Now adjust the width and height of the child 'item'
container.find('.item').height(container.innerHeight() - headerHeight - 12).width(fixedWidth - 10);
}
);
// Make resizable, vertically only everything that claims to be v-resizable !
$('.v-resizable').resizable( { handles: 's', minHeight: $(this).find('.drag_handle').height(), minWidth: $(this).parent().innerWidth() - 6, maxWidth: $(this).parent().innerWidth() - 6, stop: function()
{
// Adjust the content
var container = $(this);
var headerHeight = $(this).find('.drag_handle').height();
container.find('.item').height(container.innerHeight() - headerHeight - 12);//.width(container.innerWidth());
var parent_id = $(this).parent().id;
SetUserPreference(parent_id+'_'+this.id+'_height', $(this).height(), true); // true => persistent
}
} );
// Tabs, using JQuery BBQ to store the history
// The "tab widgets" to handle.
@@ -262,38 +295,6 @@ class iTopWebPage extends NiceWebPage
changeMonth: true,
changeYear: true
});
$('.resizable').resizable(); // Make resizable everything that claims to be resizable !
// Adjust initial size
$('.v-resizable').each( function()
{
var parent_id = $(this).parent().id;
// Restore the saved height
var iHeight = GetUserPreference(parent_id+'_'+this.id+'_height', undefined);
if (iHeight != undefined)
{
$(this).height(parseInt(iHeight, 10)); // Parse in base 10 !);
}
// Adjust the child 'item''s height and width to fit
var container = $(this);
var fixedWidth = container.parent().innerWidth() - 6;
// Set the width to fit the parent
$(this).width(fixedWidth);
var headerHeight = $(this).find('.drag_handle').height();
// Now adjust the width and height of the child 'item'
container.find('.item').height(container.innerHeight() - headerHeight - 12).width(fixedWidth - 10);
}
);
// Make resizable, vertically only everything that claims to be v-resizable !
$('.v-resizable').resizable( { handles: 's', minHeight: $(this).find('.drag_handle').height(), minWidth: $(this).parent().innerWidth() - 6, maxWidth: $(this).parent().innerWidth() - 6, stop: function()
{
// Adjust the content
var container = $(this);
var headerHeight = $(this).find('.drag_handle').height();
container.find('.item').height(container.innerHeight() - headerHeight - 12);//.width(container.innerWidth());
var parent_id = $(this).parent().id;
SetUserPreference(parent_id+'_'+this.id+'_height', $(this).height(), true); // true => persistent
}
} );
// Restore the persisted sortable order, for all sortable lists... if any
$('.sortable').each(function()
{