Adds edit and view buttons, #1752

pull/1905/head
Doug Blank 10 years ago committed by Grant Nestor
parent 393a04d1b0
commit 482ea4bb67

@ -139,6 +139,8 @@ define([
$('.download-button').click($.proxy(this.download_selected, this));
$('.shutdown-button').click($.proxy(this.shutdown_selected, this));
$('.duplicate-button').click($.proxy(this.duplicate_selected, this));
$('.view-button').click($.proxy(this.view_selected, this));
$('.edit-button').click($.proxy(this.edit_selected, this));
$('.delete-button').click($.proxy(this.delete_selected, this));
// Bind events for selection menu buttons.
@ -597,6 +599,20 @@ define([
$('.delete-button').css('display', 'none');
}
// View is visible when an item is renderable or downloadable
if (selected.length > 0 && !has_directory) {
$('.view-button').css('display', 'inline-block');
} else {
$('.view-button').css('display', 'none');
}
// Edit is visible when an item is editable
if (selected.length > 0 && !has_directory) {
$('.edit-button').css('display', 'inline-block');
} else {
$('.edit-button').css('display', 'none');
}
// If all of the items are selected, show the selector as checked. If
// some of the items are selected, show it as checked. Otherwise,
// uncheck it.
@ -937,6 +953,22 @@ define([
});
};
NotebookList.prototype.view_selected = function() {
var that = this;
that.selected.forEach(function(item) {
var item_path = item.path;
var w = window.open(utils.url_path_join('/files', item_path));
});
}
NotebookList.prototype.edit_selected = function() {
var that = this;
that.selected.forEach(function(item) {
var item_path = item.path;
var w = window.open(utils.url_path_join('/edit', item_path));
});
}
NotebookList.prototype.duplicate_selected = function() {
var message;
var selected = this.selected.slice(); // Don't let that.selected change out from under us

@ -33,6 +33,8 @@ data-terminals-available="{{terminals_available}}"
<button title="Move selected" class="move-button btn btn-default btn-xs">Move</button>
<button title="Download selected" class="download-button btn btn-default btn-xs">Download</button>
<button title="Shutdown selected notebook(s)" class="shutdown-button btn btn-default btn-xs btn-warning">Shutdown</button>
<button title="View selected" class="view-button btn btn-default btn-xs">View</button>
<button title="Edit selected" class="edit-button btn btn-default btn-xs">Edit</button>
<button title="Delete selected" class="delete-button btn btn-default btn-xs btn-danger"><i class="fa fa-trash"></i></button>
</div>
</div>

Loading…
Cancel
Save