Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
gnestor committed Jan 25, 2017
1 parent 3cbb570 commit acf4fa8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions notebook/static/tree/js/notebooklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ define([
$('.rename-button').css('display', 'none');
}

// Move is visible iff at least one item is selected, and none of them
// Move is visible if at least one item is selected, and none of them
// are a running notebook.
if (selected.length >= 1 && !has_running_notebook) {
if (selected.length > 0 && !has_running_notebook) {
$('.move-button').css('display', 'inline-block');
} else {
$('.move-button').css('display', 'none');
Expand Down Expand Up @@ -601,7 +601,7 @@ define([

// View is visible when an item is renderable or downloadable
if (selected.length > 0 && !has_directory && selected.every(function(el) {
return el.path.match(/html?|jpe?g|png|gif|tiff?|svg|bmp|ico|pdf|doc|xls/);
return el.path.match(/html?|json|jpe?g|png|gif|tiff?|svg|bmp|ico|pdf|doc|xls/);
})) {
$('.view-button').css('display', 'inline-block');
} else {
Expand Down Expand Up @@ -905,7 +905,7 @@ define([

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

window.open(utils.url_path_join(that.base_url, 'files', item_path) + '?download=1');
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 Expand Up @@ -959,17 +959,19 @@ define([
var that = this;
that.selected.forEach(function(item) {
var item_path = utils.encode_uri_components(item.path);
// Handle HTML files differently
var item_type = item_path.endsWith('.html') ? 'view' : 'files';
var w = window.open(utils.url_path_join(that.base_url, item_type, utils.encode_uri_components(item_path)), IPython._target);
window.open(utils.url_path_join(that.base_url, item_type, utils.encode_uri_components(item_path)), IPython._target);
});
};

NotebookList.prototype.edit_selected = function() {
var that = this;
that.selected.forEach(function(item) {
var item_path = utils.encode_uri_components(item.path);
// Handle ipynb files differently
var item_type = item_path.endsWith('.ipynb') ? 'notebooks' : 'edit';
var w = window.open(utils.url_path_join(that.base_url, item_type, utils.encode_uri_components(item_path)), IPython._target);
window.open(utils.url_path_join(that.base_url, item_type, utils.encode_uri_components(item_path)), IPython._target);
});
};

Expand Down

0 comments on commit acf4fa8

Please sign in to comment.