Issue #2396937 by legolasbo, Vj, subhojit777, jhodgdon: "Last placed block" color confusing in Block layout page

8.0.x
Alex Pott 2015-09-09 14:16:36 +01:00
parent 87f510f96a
commit 1842da2331
2 changed files with 20 additions and 1 deletions

View File

@ -84,6 +84,7 @@
// Add a handler for when a row is swapped, update empty regions.
tableDrag.row.prototype.onSwap = function (swappedRow) {
checkEmptyRegions(table, this);
updateLastPlaced(table, this);
};
// Add a handler so when a row is dropped, update fields dropped into
@ -132,10 +133,28 @@
updateBlockWeights(table, select[0].value);
// Modify empty regions with added or removed fields.
checkEmptyRegions(table, row);
// Update last placed block indication.
updateLastPlaced(table, row);
// Show unsaved changes warning.
if (!tableDrag.changed) {
$(Drupal.theme('tableDragChangedWarning')).insertBefore(tableDrag.table).hide().fadeIn('slow');
tableDrag.changed = true;
}
// Remove focus from selectbox.
select.trigger('blur');
});
var updateLastPlaced = function ($table, rowObject) {
// Remove the color-success class from new block if applicable.
$table.find('.color-success').removeClass('color-success');
var $rowObject = $(rowObject);
if (!$rowObject.is('.drag-previous')) {
$table.find('.drag-previous').removeClass('drag-previous');
$rowObject.addClass('drag-previous');
}
};
/**
* Update block weights in the given region.
*

View File

@ -256,7 +256,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
),
);
if ($placement && $placement == Html::getClass($entity_id)) {
$form[$entity_id]['#attributes']['class'][] = 'color-warning';
$form[$entity_id]['#attributes']['class'][] = 'color-success';
$form[$entity_id]['#attributes']['class'][] = 'js-block-placed';
}
$form[$entity_id]['info'] = array(