From 8257b8e9cdecba9533584d49c7569873a2673686 Mon Sep 17 00:00:00 2001 From: adkinsrs Date: Wed, 22 Nov 2023 13:21:53 -0500 Subject: [PATCH] progress commit - tooltips added --- www/cgi/search_gene_carts.cgi | 1 + www/css/gene_collection_manager.css | 28 +++ www/js/gene_collection_manager.js | 303 +++++++++++++--------------- 3 files changed, 169 insertions(+), 163 deletions(-) diff --git a/www/cgi/search_gene_carts.cgi b/www/cgi/search_gene_carts.cgi index 9d2e9870..8e0018a9 100755 --- a/www/cgi/search_gene_carts.cgi +++ b/www/cgi/search_gene_carts.cgi @@ -153,6 +153,7 @@ def main(): gc.user_name = row[1] gc.gene_count = len(gc.genes) gc.organism = "{0} {1}".format(row[8], row[9]) + gc.is_owner = True if gc.user_id == user.id else False gene_carts.append(gc) # Get count of total results diff --git a/www/css/gene_collection_manager.css b/www/css/gene_collection_manager.css index 4db6f8e0..06489243 100644 --- a/www/css/gene_collection_manager.css +++ b/www/css/gene_collection_manager.css @@ -11,4 +11,32 @@ hr.gc-list-element-divider { background-color: #000000; margin-left: auto; margin-right: auto; +} + +/* CSS for Floating UI components */ + +#delete_gc_popover { + width: max-content; + position: absolute; /* float above everything else to not disrupt layout */ + top: 0; + left: 0; +} + +#arrow { + position: absolute; + background: inherit; + width: 8px; + height: 8px; + transform: rotate(45deg); +} + +.tooltip { + font-weight: bold; + padding: 5px; + border-radius: 4px; + font-size: 90%; + width: max-content; + position: absolute; + top: 0; + left: 0; } \ No newline at end of file diff --git a/www/js/gene_collection_manager.js b/www/js/gene_collection_manager.js index 2915f6c2..3e21baff 100644 --- a/www/js/gene_collection_manager.js +++ b/www/js/gene_collection_manager.js @@ -6,9 +6,12 @@ let isAddFormOpen = false; const resultsPerPage = 20; // TODO - Add transformation code for quick gene collection transformations -// TODO - Finish pagination code which appeared incomplete in the original code // TODO - Add "labeled" gene collection type (i.e. marker genes) and integrate into other code snippets -// TODO - Add tooltips for each "action" button + +// TODO - Add public/private toggle button code +// TODO - Fix "edit genecart" button code +// TODO - Add "new genecart" code back from old version +// TODO - Get filter properties working // Floating UI function alias. See https://floating-ui.com/docs/getting-started#umd // Subject to change if we ever need these common names for other things. @@ -28,16 +31,16 @@ const addGeneCollectionEventListeners = () => { // Show genes when button is clicked & adjust button styling for (const classElt of document.getElementsByClassName("js-gc-unweighted-gene-list-toggle")) { classElt.addEventListener("click", (e) => { - const gcId = e.target.dataset.gcId; + const gcId = e.currentTarget.dataset.gcId; const geneList = document.getElementById(`${gcId}_gene_list`); // see if the gene_list is visible and toggle if (geneList.classList.contains("is-hidden")) { geneList.classList.remove("is-hidden"); - e.target.classList.remove("is-outlined"); + e.currentTarget.classList.remove("is-outlined"); } else { geneList.classList.add("is-hidden"); - e.target.classList.add("is-outlined"); + e.currentTarget.classList.add("is-outlined"); } }); @@ -45,9 +48,8 @@ const addGeneCollectionEventListeners = () => { for (const classElt of document.getElementsByClassName("js-gc-weighted-gene-list-toggle")) { classElt.addEventListener("click", async (e) => { - const gcId = e.target.dataset.gcId; - const geneTable = document.getElementById(`${gcId}_gene_table`); - const shareId = e.target.dataset.gcShareId; + const gcId = e.currentTarget.dataset.gcId; + const shareId = e.currentTarget.dataset.gcShareId; document.getElementById(`btn_gc_${gcId}_preview`).classList.add("is-hidden"); document.getElementById(`btn_gc_${gcId}_loading`).classList.remove("is-hidden"); @@ -67,7 +69,7 @@ const addGeneCollectionEventListeners = () => { // Hide gene collection view for (const classElt of document.getElementsByClassName("js-gc-weighted-gene-list-hider")) { classElt.addEventListener("click", (e) => { - const gcId = e.target.dataset.gcId; + const gcId = e.currentTarget.dataset.gcId; document.getElementById(`${gcId}_gene_table`).classList.add("is-hidden"); // TODO: add animate CSS with fade out document.getElementById(`btn_gc_${gcId}_hider`).classList.add("is-hidden"); document.getElementById(`btn_gc_${gcId}_preview`).classList.remove("is-hidden"); @@ -98,8 +100,11 @@ const addGeneCollectionEventListeners = () => { // Reformats the