summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries <dries@buytaert.net>2012-01-24 14:01:57 -0500
committerDries <dries@buytaert.net>2012-01-24 14:01:57 -0500
commitd7946ebdda4527152ef8a912246c316c9157dc57 (patch)
tree9120d6755bc1cdf37893eda30b92d73ea137c85c
parentaf8bd618722a38e8aafc6732b0efacd362b3e631 (diff)
downloadbrdo-d7946ebdda4527152ef8a912246c316c9157dc57.tar.gz
brdo-d7946ebdda4527152ef8a912246c316c9157dc57.tar.bz2
- Patch #1386514 by pflame, nod_, David_Rothstein: Fixed Dragging and dropping a shortcut from disabled to enabled doesn't switch the status if the dragging happens fast.
-rw-r--r--modules/shortcut/shortcut.admin.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/shortcut/shortcut.admin.js b/modules/shortcut/shortcut.admin.js
index 9a730fa67..6a6d7fe01 100644
--- a/modules/shortcut/shortcut.admin.js
+++ b/modules/shortcut/shortcut.admin.js
@@ -33,7 +33,7 @@ Drupal.behaviors.shortcutDrag = {
tableDrag.row.prototype.onSwap = function (swappedRow) {
var disabledIndex = $(table).find('tr').index($(table).find('tr.shortcut-status-disabled')) - slots - 2,
count = 0;
- $(table).find('tr.shortcut-status-enabled').nextAll().filter(':not(.shortcut-slot-empty)').each(function(index) {
+ $(table).find('tr.shortcut-status-enabled').nextAll(':not(.shortcut-slot-empty)').each(function(index) {
if (index < disabledIndex) {
count++;
}
@@ -41,15 +41,18 @@ Drupal.behaviors.shortcutDrag = {
var total = slots - count;
if (total == -1) {
var disabled = $(table).find('tr.shortcut-status-disabled');
- disabled.after(disabled.prevAll().filter(':not(.shortcut-slot-empty)').get(0));
- if ($(swappedRow).hasClass('draggable')) {
+ // To maintain the shortcut links limit, we need to move the last
+ // element from the enabled section to the disabled section.
+ var changedRow = disabled.prevAll(':not(.shortcut-slot-empty)').not($(this.element)).get(0);
+ disabled.after(changedRow);
+ if ($(changedRow).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);
+ var changedRowObject = new tableDrag.row(changedRow, 'mouse', self.indentEnabled, self.maxDepth, true);
+ changedRowObject.markChanged();
+ rowStatusChange(changedRowObject);
}
}
else if (total != visibleLength) {