Skip to content

Commit cbfc4da

Browse files
authored
Merge pull request #5351 from berendjan/download_multiple_files
tree added download multiple files
2 parents ebd2b57 + feba975 commit cbfc4da

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

notebook/static/tree/js/notebooklist.js

+8-13
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,9 @@ define([
729729
$('.move-button').css('display', 'none');
730730
}
731731

732-
// Download is only visible when one item is selected, and it is not a
733-
// 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) {
732+
// Download is only visible when items are selected, and none are
733+
// running notebooks or a directories
734+
if (selected.length > 0 && !has_running_notebook && !has_directory) {
736735
$('.download-button').css('display', 'inline-block');
737736
} else {
738737
$('.download-button').css('display', 'none');
@@ -1150,15 +1149,11 @@ define([
11501149

11511150
NotebookList.prototype.download_selected = function() {
11521151
var that = this;
1153-
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;
1160-
1161-
window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
1152+
1153+
that.selected.forEach(function(item) {
1154+
var item_path = utils.encode_uri_components(item.path);
1155+
window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
1156+
});
11621157
};
11631158

11641159
NotebookList.prototype.delete_selected = function() {

0 commit comments

Comments
 (0)