e03fbe234ac861ea3b1831f01a18b36aea53a58d chmalee Tue Feb 25 11:58:38 2025 -0800 Make font-size of breadcrumb text larger, make the final breadcrumb not underlined since it cannot be clicked, make the final breadcrumb not clickable, refs ##31058 diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js index 152de77e97a..c531b3b323b 100644 --- src/hg/js/hgMyData.js +++ src/hg/js/hgMyData.js @@ -329,69 +329,72 @@ function handleCheckboxSelect(ev, table, row) { // depending on the state of the checkbox, we will be adding information // to the div, or removing information. We will also be potentially checking/unchecking // all of the checkboxes if the selectAll box was clicked. The data variable // will hold all the information we want to keep visible in the info div let data = {}; // get all of the currently selected rows (may be more than just the one that // was most recently clicked) table.rows({selected: true}).data().each(function(row, ix) { data[ix] = row; }); updateSelectedFileDiv(data); } - function createOneCrumb(table, dirName, dirFullPath) { + function createOneCrumb(table, dirName, dirFullPath, doAddEvent) { // make a new span that can be clicked to nav through the table let newSpan = document.createElement("span"); newSpan.id = dirName; newSpan.textContent = decodeURIComponent(dirName); newSpan.classList.add("breadcrumb"); + if (doAddEvent) { newSpan.addEventListener("click", function(e) { dataTableShowDir(table, dirName, dirFullPath); table.draw(); dataTableCustomOrder(table, {"fullPath": dirFullPath}); table.draw(); }); + } else { + // can't click the final crumb so don't underline it + newSpan.style.textDecoration = "unset"; + } return newSpan; } function dataTableEmptyBreadcrumb(table) { let currBreadcrumb = document.getElementById("breadcrumb"); currBreadcrumb.replaceChildren(currBreadcrumb.firstChild); - currBreadcrumb.firstChild.style.cursor = "unset"; - currBreadcrumb.firstChild.style.textDecoration = "unset"; } function dataTableCreateBreadcrumb(table, dirName, dirFullPath) { // Re-create the breadcrumb nav to move back through directories let currBreadcrumb = document.getElementById("breadcrumb"); // empty the node but leave the first "My Data" span if (currBreadcrumb.children.length > 1) { currBreadcrumb.replaceChildren(currBreadcrumb.firstChild); } - currBreadcrumb.firstChild.style.cursor = "pointer"; - currBreadcrumb.firstChild.style.textDecoration = "underline"; let components = dirFullPath.split("/"); + let numComponents = components.length; components.forEach(function(dirName, dirNameIx) { if (!dirName) { return; } + let doAddEvent = dirNameIx !== (numComponents - 1); let path = components.slice(0, dirNameIx+1); componentFullPath = path.join('/'); - let newSpan = createOneCrumb(table, dirName, componentFullPath); + let newSpan = createOneCrumb(table, dirName, componentFullPath, doAddEvent); currBreadcrumb.appendChild(document.createTextNode(" > ")); currBreadcrumb.appendChild(newSpan); }); } // search related functions: function clearSearch(table) { // clear any fixed searches so we can apply a new one let currSearches = table.search.fixed().toArray(); currSearches.forEach((name) => table.search.fixed(name, null)); } function dataTableShowTopLevel(table) { // show all the "root" files, which are files (probably mostly directories) // with no parentDir @@ -664,31 +667,31 @@ items: 'row', style: 'multi+shift', // default to a single click is all that's needed }, pageLength: 25, scrollY: 600, scrollCollapse: true, // when less than scrollY height is needed, make the table shorter deferRender: true, // only draw into the DOM the nodes we need for each page orderCellsTop: true, // when viewing a subdirectory, the directory becomes a part of // the header, this option prevents those cells from being used to // sort the table layout: { top2Start: { div: { className: "", id: "breadcrumb", - html: "<span id=\"rootBreadcrumb\">My Data</span>", + html: "<span id=\"rootBreadcrumb\" class=\"breadcrumb\">My Data</span>", } }, topStart: { buttons: [ { text: 'Upload', action: function() {return;}, className: 'uploadButton', enabled: false, // disable by default in case user is not logged in }, ], quota: null, }, }, columnDefs: [