summaryrefslogtreecommitdiff
path: root/program/js/treelist.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-07-16 11:08:11 +0200
committerAleksander Machniak <alec@alec.pl>2014-07-16 11:08:11 +0200
commit3cb61e7528c2a8544083bf14e02ea4b9387671fb (patch)
treed162fc94ad941479a965603503c1b441673b4535 /program/js/treelist.js
parente0492d213b4c087b7092fa6bdc3dfecbc14f9bcf (diff)
Collapsible (and iconized) folders tree in folder manager (#1489648)
Diffstat (limited to 'program/js/treelist.js')
-rw-r--r--program/js/treelist.js36
1 files changed, 34 insertions, 2 deletions
diff --git a/program/js/treelist.js b/program/js/treelist.js
index 6a5518a7b..ab1363030 100644
--- a/program/js/treelist.js
+++ b/program/js/treelist.js
@@ -68,6 +68,8 @@ function rcube_treelist_widget(node, p)
tree_state,
ui_droppable,
ui_draggable,
+ draggable_opts,
+ droppable_opts,
list_id = (container.attr('id') || p.id_prefix || '0'),
me = this;
@@ -470,7 +472,7 @@ function rcube_treelist_widget(node, p)
/**
*
*/
- function reset()
+ function reset(keep_content)
{
select('');
@@ -478,7 +480,22 @@ function rcube_treelist_widget(node, p)
indexbyid = {};
drag_active = false;
- container.html('');
+ if (keep_content) {
+ if (draggable_opts) {
+ draggable('destroy');
+ draggable(draggable_opts);
+ }
+
+ if (droppable_opts) {
+ droppable('destroy');
+ droppable(droppable_opts);
+ }
+
+ update_data();
+ }
+ else {
+ container.html('');
+ }
reset_search();
}
@@ -1043,6 +1060,13 @@ function rcube_treelist_widget(node, p)
{
if (!opts) opts = {};
+ if ($.type(opts) == 'string') {
+ $('li:not(.virtual)', container).droppable(opts);
+ return this;
+ }
+
+ droppable_opts = opts;
+
var my_opts = $.extend({
greedy: true,
tolerance: 'pointer',
@@ -1084,8 +1108,16 @@ function rcube_treelist_widget(node, p)
{
if (!opts) opts = {};
+ if ($.type(opts) == 'string') {
+ $('li:not(.virtual)', container).draggable(opts);
+ return this;
+ }
+
+ draggable_opts = opts;
+
var my_opts = $.extend({
appendTo: 'body',
+ revert: 'invalid',
iframeFix: true,
addClasses: false,
cursorAt: {left: -20, top: 5},