Commit 1842da23 authored by alexpott's avatar alexpott

Issue #2396937 by legolasbo, Vj, subhojit777, jhodgdon: "Last placed block"...

Issue #2396937 by legolasbo, Vj, subhojit777, jhodgdon: "Last placed block" color confusing in Block layout page
parent 87f510f9
......@@ -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.
*
......
......@@ -256,7 +256,7 @@ protected function buildBlocksForm() {
),
);
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(
......
Markdown is supported
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