Commit 5d9ccc3e authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1867999: the annotation block should be empty if no title and no content

behatnotneeded

Change-Id: Ida169d4f569b9406ca350e84ecd867a9002af945
parent feae1904
...@@ -15,6 +15,14 @@ function loadGridTranslate(grid, blocks) { ...@@ -15,6 +15,14 @@ function loadGridTranslate(grid, blocks) {
gridRemoveEvents(); gridRemoveEvents();
// load grid with empty blocks // load grid with empty blocks
$.each(blocks, function(index, block) { $.each(blocks, function(index, block) {
if (block.content == null) {
block.content = '';
}
else {
if (!$(block.content).children().hasClass('collapse')) {
minHeight = block.height;
}
}
var blockContent = $('<div id="block_' + block.id + '"><div class="grid-stack-item-content">' var blockContent = $('<div id="block_' + block.id + '"><div class="grid-stack-item-content">'
+ block.content + + block.content +
'<div/><div/>'); '<div/><div/>');
...@@ -47,16 +55,21 @@ function loadGridTranslate(grid, blocks) { ...@@ -47,16 +55,21 @@ function loadGridTranslate(grid, blocks) {
function loadGrid(grid, blocks) { function loadGrid(grid, blocks) {
var minWidth = grid.opts.minCellColumns, var minWidth = grid.opts.minCellColumns,
minHeight; minHeight, content;
window.isGridstackRendering = true; window.isGridstackRendering = true;
$.each(blocks, function(index, block) { $.each(blocks, function(index, block) {
minHeight = null; minHeight = null;
if (block.content == null) {
block.content = '';
}
else {
if (!$(block.content).children().hasClass('collapse')) {
minHeight = block.height;
}
}
var blockContent = $('<div id="block_' + block.id + '"><div class="grid-stack-item-content">' var blockContent = $('<div id="block_' + block.id + '"><div class="grid-stack-item-content">'
+ block.content + + block.content +
'<div/><div/>'); '<div/><div/>');
if (!$(block.content).children().hasClass('collapse')) {
minHeight = block.height;
}
addNewWidget(blockContent, block.id, block, grid, block.class, minWidth, minHeight); addNewWidget(blockContent, block.id, block, grid, block.class, minWidth, minHeight);
}); });
...@@ -203,17 +216,20 @@ function updateBlockSizes(grid) { ...@@ -203,17 +216,20 @@ function updateBlockSizes(grid) {
$.each(grid.children(), function(index, element) { $.each(grid.children(), function(index, element) {
var width = $(element).attr('data-gs-width'), var width = $(element).attr('data-gs-width'),
prevHeight = $(element).attr('data-gs-height'), prevHeight = $(element).attr('data-gs-height'),
height = Math.ceil( height = 1;
( if ($(element).find('.grid-stack-item-content .gridstackblock').length > 0) {
$(element).find('.grid-stack-item-content .gridstackblock')[0].scrollHeight + height = Math.ceil(
grid.data('gridstack').opts.verticalMargin (
) $(element).find('.grid-stack-item-content .gridstackblock')[0].scrollHeight +
/ grid.data('gridstack').opts.verticalMargin
( )
grid.data('gridstack').cellHeight() + /
grid.data('gridstack').opts.verticalMargin (
) grid.data('gridstack').cellHeight() +
); grid.data('gridstack').opts.verticalMargin
)
);
}
if (+prevHeight != height) { if (+prevHeight != height) {
grid.data('gridstack').resize(element, +width, height); grid.data('gridstack').resize(element, +width, height);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment