From 2c0d3e1dd0a3df01c8adea0de5f2826f0bcb9434 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 25 Jul 2014 11:40:37 -0400
Subject: [PATCH] Fix drag-n-drop after folder move/create (#1489648)
---
program/js/treelist.js | 13 +++++++++++--
program/js/app.js | 3 +++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/program/js/app.js b/program/js/app.js
index a489628..f25b808 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -5891,6 +5891,9 @@
if (!this.gui_objects.subscriptionlist)
return false;
+ // disable drag-n-drop temporarily
+ this.subscription_list.draggable('destroy').droppable('destroy');
+
var row, n, tmp, tmp_name, rowid, collator, pos, p, parent = '',
folders = [], list = [], slist = [],
list_element = $(this.gui_objects.subscriptionlist);
diff --git a/program/js/treelist.js b/program/js/treelist.js
index ab13630..5071026 100644
--- a/program/js/treelist.js
+++ b/program/js/treelist.js
@@ -482,12 +482,14 @@
if (keep_content) {
if (draggable_opts) {
- draggable('destroy');
+ if (ui_draggable)
+ draggable('destroy');
draggable(draggable_opts);
}
if (droppable_opts) {
- droppable('destroy');
+ if (ui_droppable)
+ droppable('destroy');
droppable(droppable_opts);
}
@@ -1061,6 +1063,9 @@
if (!opts) opts = {};
if ($.type(opts) == 'string') {
+ if (opts == 'destroy') {
+ ui_droppable = null;
+ }
$('li:not(.virtual)', container).droppable(opts);
return this;
}
@@ -1109,6 +1114,9 @@
if (!opts) opts = {};
if ($.type(opts) == 'string') {
+ if (opts == 'destroy') {
+ ui_draggable = null;
+ }
$('li:not(.virtual)', container).draggable(opts);
return this;
}
@@ -1121,6 +1129,7 @@
iframeFix: true,
addClasses: false,
cursorAt: {left: -20, top: 5},
+ create: function(e, ui) { ui_draggable = ui; },
helper: function(e) {
return $('<div>').attr('id', 'rcmdraglayer')
.text($.trim($(e.target).first().text()));
--
Gitblit v1.9.1