|
|
|
|
@ -355,7 +355,14 @@ define([
|
|
|
|
|
file: 'edit',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handles when any row selector checkbox is toggled.
|
|
|
|
|
*/
|
|
|
|
|
NotebookList.prototype._selection_changed = function() {
|
|
|
|
|
|
|
|
|
|
// Use a JQuery selector to find each row with a checked checkbox. If
|
|
|
|
|
// we decide to add more checkboxes in the future, this code will need
|
|
|
|
|
// to be changed to distinguish which checkbox is the row selector.
|
|
|
|
|
var selected = [];
|
|
|
|
|
var has_running_notebook = false;
|
|
|
|
|
var has_directory = false;
|
|
|
|
|
@ -363,16 +370,22 @@ define([
|
|
|
|
|
var that = this;
|
|
|
|
|
$('.list_item :checked').each(function(index, item) {
|
|
|
|
|
var parent = $(item).parent().parent();
|
|
|
|
|
selected.push({
|
|
|
|
|
name: parent.data('name'),
|
|
|
|
|
path: parent.data('path'),
|
|
|
|
|
type: parent.data('type')
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
has_running_notebook = has_running_notebook ||
|
|
|
|
|
(parent.data('type') == 'notebook' && that.sessions[parent.data('path')] !== undefined);
|
|
|
|
|
has_file = has_file || parent.data('type') == 'file';
|
|
|
|
|
has_directory = has_directory || parent.data('type') == 'directory';
|
|
|
|
|
// If the item doesn't have an upload button, it can be selected.
|
|
|
|
|
if (parent.find('.upload_button').length === 0) {
|
|
|
|
|
selected.push({
|
|
|
|
|
name: parent.data('name'),
|
|
|
|
|
path: parent.data('path'),
|
|
|
|
|
type: parent.data('type')
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Set flags according to what is selected. Flags are later
|
|
|
|
|
// used to decide which action buttons are visible.
|
|
|
|
|
has_running_notebook = has_running_notebook ||
|
|
|
|
|
(parent.data('type') == 'notebook' && that.sessions[parent.data('path')] !== undefined);
|
|
|
|
|
has_file = has_file || parent.data('type') == 'file';
|
|
|
|
|
has_directory = has_directory || parent.data('type') == 'directory';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.selected = selected;
|
|
|
|
|
|
|
|
|
|
@ -383,14 +396,15 @@ define([
|
|
|
|
|
$('.rename-button').css('display', 'none');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Shutdown is only visible when one or more notebooks are visible.
|
|
|
|
|
// Shutdown is only visible when one or more notebooks running notebooks
|
|
|
|
|
// are selected and no non-notebook items are selected.
|
|
|
|
|
if (has_running_notebook && !(has_file || has_directory)) {
|
|
|
|
|
$('.shutdown-button').css('display', 'inline-block');
|
|
|
|
|
} else {
|
|
|
|
|
$('.shutdown-button').css('display', 'none');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Duplicate isn't visible if a directory is selected.
|
|
|
|
|
// Duplicate isn't visible when a directory is selected.
|
|
|
|
|
if (selected.length > 0 && !has_directory) {
|
|
|
|
|
$('.duplicate-button').css('display', 'inline-block');
|
|
|
|
|
} else {
|
|
|
|
|
@ -704,7 +718,6 @@ define([
|
|
|
|
|
var on_success = function () {
|
|
|
|
|
item.removeClass('new-file');
|
|
|
|
|
that.add_link(model, item);
|
|
|
|
|
that.add_delete_button(item);
|
|
|
|
|
that.session_list.load_sessions();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|