5df85e75e5ad83445d5fd90b5bd698f4bd4f315b braney Tue Feb 20 14:29:21 2018 -0800 warn the user if there are no collections and they try to add to one with the "add" menu diff --git src/hg/js/hgCollection.js src/hg/js/hgCollection.js index 493bfa6..4d74178 100644 --- src/hg/js/hgCollection.js +++ src/hg/js/hgCollection.js @@ -8,30 +8,34 @@ var selectedTree; var $tracks; // the #tracks object var trees = []; var isDirty = false; var goTracks = false; var doAjaxAsync = true; var emptyCollectionText; var addWithoutCollectionText; function currentTrackItems(node) { // populate the menu for the currentCollection tree var items = { addItem: { // The "add" menu item label: "Add", action: function () { + if (selectedNode === undefined) { + alert(addWithoutCollectionText); + return; + } var nodeIds = $("#tracks").jstree( "get_selected"); isDirty = true; var nodes = []; var node; for(ii=0; ii < nodeIds.length; ii++) { node = $("#tracks").jstree('get_node', nodeIds[ii]); if (node.children.length === 0) nodes.push(node); } var parentId = $(selectedNode).attr('id'); checkEmpty(parentId); $(selectedTree).jstree("copy_node", nodes, parentId,'last'); } } };