diff options
Diffstat (limited to 'modules/block/block.js')
-rw-r--r-- | modules/block/block.js | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/modules/block/block.js b/modules/block/block.js index ce4995dca..acd3f5ae2 100644 --- a/modules/block/block.js +++ b/modules/block/block.js @@ -113,28 +113,12 @@ Drupal.behaviors.blockDrag = { $('select.block-region-select', context).once('block-region-select', function () { $(this).change(function (event) { // Make our new row and select field. - var row = $(this).parents('tr:first'); + var row = $(this).closest('tr'); var select = $(this); tableDrag.rowObject = new tableDrag.row(row); - // Find the correct region and insert the row as the first in the region. - $('tr.region-message', table).each(function () { - if ($(this).is('.region-' + select[0].value + '-message')) { - // Add the new row and remove the old one. - $(this).after(row); - // Manually update weights and restripe. - tableDrag.updateFields(row.get(0)); - tableDrag.rowObject.changed = true; - if (tableDrag.oldRowElement) { - $(tableDrag.oldRowElement).removeClass('drag-previous'); - } - tableDrag.oldRowElement = row.get(0); - tableDrag.restripeTable(); - tableDrag.rowObject.markChanged(); - tableDrag.oldRowElement = row; - $(row).addClass('drag-previous'); - } - }); + // Find the correct region and insert the row as the last in the region. + table.find('.region-' + select[0].value + '-message').nextUntil('.region-message').last().before(row); // Modify empty regions with added or removed fields. checkEmptyRegions(table, row); @@ -153,7 +137,7 @@ Drupal.behaviors.blockDrag = { } } // This region has become empty. - if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').size() == 0) { + if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').length == 0) { $(this).removeClass('region-populated').addClass('region-empty'); } // This region has become populated. |