1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

add download multi dirents api

This commit is contained in:
lian
2016-04-28 15:16:58 +08:00
parent 5a52ad7168
commit 419645fdc2
6 changed files with 185 additions and 2 deletions

View File

@@ -466,6 +466,7 @@ define([
'click #mv-dirents': 'mv',
'click #cp-dirents': 'cp',
'click #del-dirents': 'del',
'click #download-dirents': 'download',
'click .by-name': 'sortByName',
'click .by-time': 'sortByTime',
'click .basic-upload-btn': 'uploadFile',
@@ -799,6 +800,30 @@ define([
}
},
download: function () {
var dirents = this.dir,
selected_dirents = dirents.where({'selected':true}),
selected_names = '';
$(selected_dirents).each(function() {
selected_names += this.get('obj_name') + ',';
});
$.ajax({
url: Common.getUrl({
name: 'download_dirents',
repo_id: dirents.repo_id
}) + '?parent_dir=' + encodeURIComponent(dirents.path) + '&dirents=' + encodeURIComponent(selected_names),
dataType: 'json',
success: function(data) {
location.href = data['url'];
},
error: function (xhr) {
Common.ajaxErrorHandler(xhr);
}
});
},
del: function () {
var dirents = this.dir;
var _this = this;