1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 16:10:26 +00:00

[backbone] Support render other repos in mv file dialog

This commit is contained in:
Daniel Pan
2015-01-29 11:28:53 +08:00
parent cf91a39f84
commit e1b4fc3f16
4 changed files with 47 additions and 1 deletions

View File

@@ -249,6 +249,7 @@ define([
if (!this.dirView.dir.encrypted) {
$('#other-repos').show();
FileTree.prepareOtherReposTree({cur_repo_id: this.dirView.dir.repo_id});
}
if (op_type == 'mv') {

View File

@@ -18,7 +18,7 @@ define([
},
reset: function() {
console.log(this.template({groups: this.groups.models}));
//console.log(this.template({groups: this.groups.models}));
},
fetch: function() {

View File

@@ -59,6 +59,7 @@ define([
case 'get_file_op_url': return siteRoot + 'ajax/repo/' + options.repo_id + '/file_op_url/';
case 'get_dirents': return siteRoot + 'ajax/repo/' + options.repo_id + '/dirents/';
case 'thumbnail_create': return siteRoot + 'thumbnail/' + options.repo_id + '/create/';
case 'unenc_rw_repos': return siteRoot + 'ajax/unenc-rw-repos/';
case 'get_cp_progress': return '';
case 'cancel_cp': return '';
case 'get_shared_link': return '';

View File

@@ -271,8 +271,52 @@ define([
container.removeClass('hide');
}
});
},
prepareOtherReposTree: function(options) {
var _this = this;
$('#mv-dir-list #other-repos .hd').click(function() {
var span = $('span', $(this)),
form = $('#mv-form'),
loading_tip = $(this).next(),
dir_tree_container = $("#mv-dir-list #other-repos #other-repos-dirs");
if (span.hasClass('icon-caret-right')) {
span.attr('class','icon-caret-down');
loading_tip.show();
$.ajax({
url: Common.getUrl({name:'unenc_rw_repos'}),
cache: false,
dataType: 'json',
success: function(data) {
var other_repos = [];
var cur_repo_id = options.cur_repo_id;
for (var i = 0, len = data.length; i < len; i++) {
if (data[i].id != cur_repo_id) {
other_repos.push({
'data': data[i].name,
'attr': {'repo_id': data[i].id, 'root_node': true},
'state': 'closed'
});
}
}
loading_tip.hide();
_this.renderDirTree(dir_tree_container, form, other_repos);
dir_tree_container.removeClass('hide');
}
});
} else {
span.attr('class','icon-caret-right');
dir_tree_container.addClass('hide');
}
});
}
};
return FileTree;