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

[dir view] modification

This commit is contained in:
llj
2017-01-07 17:55:16 +08:00
parent 77fa8c0c7a
commit fd4df3792c
4 changed files with 13 additions and 6 deletions

View File

@@ -788,19 +788,21 @@ define([
}, },
download: function () { download: function () {
var selected_dirents = this.dir.where({'selected':true}); var dirents = this.dir;
var selected_dirents = dirents.where({'selected':true});
var selected_names = [];
// select 1 item, and it is a file // select 1 item, and it is a file
if (selected_dirents.length == 1 && if (selected_dirents.length == 1 &&
selected_dirents[0].get('is_file')) { selected_dirents[0].get('is_file')) {
location.href = selected_dirents[0].getDownloadUrl(); location.href = selected_dirents[0].getDownloadUrl();
return; return;
} }
var selected_names = [];
$(selected_dirents).each(function() { $(selected_dirents).each(function() {
selected_names.push(this.get('obj_name')); selected_names.push(this.get('obj_name'));
}); });
Common.zipDownloadDirents(this.dir.repo_id, this.dir.path, selected_names); Common.zipDownload(dirents.repo_id, dirents.path, selected_names);
}, },
del: function () { del: function () {

View File

@@ -153,8 +153,9 @@ define([
download: function() { download: function() {
this.closeMenu(); this.closeMenu();
var dir = this.dir;
var obj_name = this.model.get('obj_name'); var obj_name = this.model.get('obj_name');
Common.zipDownloadDirents(this.dir.repo_id, this.dir.path, obj_name); Common.zipDownload(dir.repo_id, dir.path, obj_name);
return false; return false;
}, },

View File

@@ -127,7 +127,9 @@ define([
}, },
downloadDir: function() { downloadDir: function() {
Common.zipDownloadDirents(this.dirView.dir.repo_id, this.dirView.dir.path, this.model.get('obj_name')); var dir = this.dirView.dir;
var obj_name = this.model.get('obj_name');
Common.zipDownload(dir.repo_id, dir.path, obj_name);
return false; return false;
}, },

View File

@@ -954,8 +954,10 @@ define([
} }
}, },
zipDownloadDirents:function(repo_id, parent_dir, dirents) { // for 'dir view': download multi dirents; dir download
zipDownload:function(repo_id, parent_dir, dirents) {
var _this = this; var _this = this;
var interval; var interval;
var zip_token; var zip_token;
var packagingTip = gettext("Packaging..."); var packagingTip = gettext("Packaging...");