Skip to content
Snippets Groups Projects
Commit 64c63139 authored by catch's avatar catch
Browse files

Issue #1344752 by pflame, JacobSingh: Fixed Drag and Drop of shortcuts between...

Issue #1344752 by pflame, JacobSingh: Fixed Drag and Drop of shortcuts between Enable and Disable Does not respect the Shortcuts Limit.
parent 46c65ce4
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -42,6 +42,15 @@ Drupal.behaviors.shortcutDrag = { ...@@ -42,6 +42,15 @@ Drupal.behaviors.shortcutDrag = {
if (total == -1) { if (total == -1) {
var disabled = $(table).find('tr.shortcut-status-disabled'); var disabled = $(table).find('tr.shortcut-status-disabled');
disabled.after(disabled.prevAll().filter(':not(.shortcut-slot-empty)').get(0)); disabled.after(disabled.prevAll().filter(':not(.shortcut-slot-empty)').get(0));
if ($(swappedRow).hasClass('draggable')) {
// The dropped element will automatically be marked as changed by
// the tableDrag system. However, the row that swapped with it
// has moved to the "disabled" section, so we need to force its
// status to be disabled and mark it also as changed.
swappedRowObject = new tableDrag.row(swappedRow, 'mouse', self.indentEnabled, self.maxDepth, true);
swappedRowObject.markChanged();
rowStatusChange(swappedRowObject);
}
} }
else if (total != visibleLength) { else if (total != visibleLength) {
if (total > visibleLength) { if (total > visibleLength) {
...@@ -59,13 +68,17 @@ Drupal.behaviors.shortcutDrag = { ...@@ -59,13 +68,17 @@ Drupal.behaviors.shortcutDrag = {
// Add a handler so when a row is dropped, update fields dropped into new regions. // Add a handler so when a row is dropped, update fields dropped into new regions.
tableDrag.onDrop = function () { tableDrag.onDrop = function () {
rowStatusChange(this.rowObject);
return true;
};
function rowStatusChange(rowObject) {
// Use "status-message" row instead of "status" row because // Use "status-message" row instead of "status" row because
// "status-{status_name}-message" is less prone to regexp match errors. // "status-{status_name}-message" is less prone to regexp match errors.
var statusRow = $(this.rowObject.element).prevAll('tr.shortcut-status').get(0); var statusRow = $(rowObject.element).prevAll('tr.shortcut-status').get(0);
var statusName = statusRow.className.replace(/([^ ]+[ ]+)*shortcut-status-([^ ]+)([ ]+[^ ]+)*/, '$2'); var statusName = statusRow.className.replace(/([^ ]+[ ]+)*shortcut-status-([^ ]+)([ ]+[^ ]+)*/, '$2');
var statusField = $('select.shortcut-status-select', this.rowObject.element); var statusField = $('select.shortcut-status-select', rowObject.element);
statusField.val(statusName); statusField.val(statusName);
return true;
}; };
tableDrag.restripeTable = function () { tableDrag.restripeTable = function () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment