[ticket/578] Correctly assign classes to element upon deleting modules

B3P-578
This commit is contained in:
Marc Alexander
2015-06-06 21:22:37 +02:00
parent 55d7991829
commit e5319bfbe3

View File

@@ -83,16 +83,20 @@ phpbb.addAjaxCallback('b3p_delete_module', function(res) {
return; return;
} }
var el = $(this).parents('tr:first'), var $deletedRow = $(this).parents('tr:first'),
nextEl = el.next(); $nextRow = $deletedRow.next();
el.remove(); $deletedRow.remove();
// Fix classes of next elements // Fix classes of next elements
while (nextEl !== undefined && nextEl.is('tr')) { while ($nextRow !== undefined && $nextRow.is('tr')) {
var nextElClass = (nextEl.attr('class') === 'row1') ? 'row2' : 'row1'; var nextRowClass = ($nextRow.attr('class') === 'row1') ? 'row2' : 'row1';
nextEl.attr('class', nextElClass);
nextEl = nextEl.next(); if ($nextRow.attr('class') !== 'row3') {
$nextRow.attr('class', nextRowClass);
}
$nextRow = $nextRow.next();
} }
}); });