Skip to content

Commit

Permalink
Merge pull request #5351 from berendjan/download_multiple_files
Browse files Browse the repository at this point in the history
tree added download multiple files
  • Loading branch information
Zsailer authored May 15, 2020
2 parents ebd2b57 + feba975 commit cbfc4da
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions notebook/static/tree/js/notebooklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,9 @@ define([
$('.move-button').css('display', 'none');
}

// Download is only visible when one item is selected, and it is not a
// running notebook or a directory
// TODO(nhdaly): Add support for download multiple items at once.
if (selected.length === 1 && !has_running_notebook && !has_directory) {
// Download is only visible when items are selected, and none are
// running notebooks or a directories
if (selected.length > 0 && !has_running_notebook && !has_directory) {
$('.download-button').css('display', 'inline-block');
} else {
$('.download-button').css('display', 'none');
Expand Down Expand Up @@ -1150,15 +1149,11 @@ define([

NotebookList.prototype.download_selected = function() {
var that = this;

// TODO(nhdaly): Support download multiple items at once.
if (that.selected.length !== 1){
return;
}

var item_path = that.selected[0].path;

window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);

that.selected.forEach(function(item) {
var item_path = utils.encode_uri_components(item.path);
window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
});
};

NotebookList.prototype.delete_selected = function() {
Expand Down

0 comments on commit cbfc4da

Please sign in to comment.