Skip to content

Commit 76d5422

Browse files
committed
tree added download multiple files
1 parent 7de8df4 commit 76d5422

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

notebook/static/tree/js/notebooklist.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,10 @@ define([
729729
$('.move-button').css('display', 'none');
730730
}
731731

732-
// Download is only visible when one item is selected, and it is not a
732+
// Download is only visible when items is selected, and it is not a
733733
// running notebook or a directory
734-
// TODO(nhdaly): Add support for download multiple items at once.
735-
if (selected.length === 1 && !has_running_notebook && !has_directory) {
734+
// Added support for downloading multiple items
735+
if (selected.length > 0 && !has_running_notebook && !has_directory) {
736736
$('.download-button').css('display', 'inline-block');
737737
} else {
738738
$('.download-button').css('display', 'none');
@@ -1150,15 +1150,15 @@ define([
11501150

11511151
NotebookList.prototype.download_selected = function() {
11521152
var that = this;
1153+
1154+
that.selected.forEach(function(item) {
1155+
var item_path = utils.encode_uri_components(item.path);
1156+
window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
1157+
});
11531158

1154-
// TODO(nhdaly): Support download multiple items at once.
1155-
if (that.selected.length !== 1){
1156-
return;
1157-
}
1158-
1159-
var item_path = that.selected[0].path;
1159+
// var item_path = that.selected[0].path;
11601160

1161-
window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
1161+
// window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
11621162
};
11631163

11641164
NotebookList.prototype.delete_selected = function() {

0 commit comments

Comments
 (0)