mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 14:21:23 +00:00
[jstree] fixed node select/check bug
This commit is contained in:
@@ -546,13 +546,10 @@ FileTree.prototype.renderFileTree = function(container, repo_data, options) {
|
|||||||
repo_id = node.attr('repo_id');
|
repo_id = node.attr('repo_id');
|
||||||
} else {
|
} else {
|
||||||
path_array.shift();
|
path_array.shift();
|
||||||
|
repo_id = node.parents('[root_node=true]').attr('repo_id');
|
||||||
if (node.attr('type') == 'dir') {
|
if (node.attr('type') == 'dir') {
|
||||||
// node is a subdir
|
path = '/' + path_array.join('/') + '/';
|
||||||
repo_id = node.attr('repo_id');
|
|
||||||
path = '/' + path_array.join('/') + '/'; // dir path is ended with '/'
|
|
||||||
} else {
|
} else {
|
||||||
// node is a file
|
|
||||||
repo_id = this._get_parent(node).attr('repo_id');
|
|
||||||
path = '/' + path_array.join('/');
|
path = '/' + path_array.join('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -575,12 +572,13 @@ FileTree.prototype.renderDirTree = function(container, form, repo_data) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.bind('select_node.jstree', function(e, data) {
|
.bind('select_node.jstree', function(e, data) {
|
||||||
var path;
|
var path, repo_id;
|
||||||
var repo_id = data.rslt.obj.attr('repo_id') || data.inst._get_parent(data.rslt.obj).attr('repo_id');
|
|
||||||
var path_array = data.inst.get_path(data.rslt.obj);
|
var path_array = data.inst.get_path(data.rslt.obj);
|
||||||
if (path_array.length == 1) {
|
if (path_array.length == 1) {
|
||||||
path = '/';
|
path = '/';
|
||||||
|
repo_id = data.rslt.obj.attr('repo_id');
|
||||||
} else {
|
} else {
|
||||||
|
repo_id = data.rslt.obj.parents('[root_node=true]').attr('repo_id');
|
||||||
path_array.shift();
|
path_array.shift();
|
||||||
path = '/' + path_array.join('/') + '/';
|
path = '/' + path_array.join('/') + '/';
|
||||||
}
|
}
|
||||||
@@ -598,8 +596,7 @@ FileTree.prototype.renderDirTree = function(container, form, repo_data) {
|
|||||||
path = '/';
|
path = '/';
|
||||||
repo_id = data.attr('repo_id');
|
repo_id = data.attr('repo_id');
|
||||||
} else {
|
} else {
|
||||||
var root_node = data.parents('[root_node=true]');
|
repo_id = data.parents('[root_node=true]').attr('repo_id');
|
||||||
repo_id = root_node.attr('repo_id');
|
|
||||||
path.shift();
|
path.shift();
|
||||||
path = '/' + path.join('/') + '/';
|
path = '/' + path.join('/') + '/';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user