about summary refs log tree commit diff
path: root/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-03-12 12:48:28 -0500
committerFrederick Muriuki Muriithi2025-03-12 12:50:04 -0500
commitb5842a85b3277462fb1083ee22d516a085da0fea (patch)
tree016a801dd96555fa1e05e0b65766f2b4796cf1e1 /uploader
parent43118074beaaebd8e3ed0bc134ef6edf918abd41 (diff)
downloadgn-uploader-b5842a85b3277462fb1083ee22d516a085da0fea.tar.gz
Remove obsolete and incompatible row-selection code.
Diffstat (limited to 'uploader')
-rw-r--r--uploader/static/js/datatables.js56
-rw-r--r--uploader/static/js/populations.js1
-rw-r--r--uploader/static/js/species.js1
-rw-r--r--uploader/templates/phenotypes/view-dataset.html22
4 files changed, 1 insertions, 79 deletions
diff --git a/uploader/static/js/datatables.js b/uploader/static/js/datatables.js
index f93fdee..d16ad9e 100644
--- a/uploader/static/js/datatables.js
+++ b/uploader/static/js/datatables.js
@@ -1,61 +1,5 @@
 /** Handlers for events in datatables **/
 
-var dtAddRowSelectionHandler = (tableId) => {
-    $(tableId).on("draw.dt", (event) => {
-        $(".chk-row-select").on("change", (event) => {
-            var checkboxOrRadio = event.target;
-            var tablerow = checkboxOrRadio.parentElement.parentElement;
-            var tableclass = tablerow.getAttribute("class");
-            if(checkboxOrRadio.checked) {
-                if (checkboxOrRadio.type == "radio") {
-                    $(tableId + " tr").each((index, row) => {
-                        var rowKlass = $(row).attr("class") || "";
-                        row.setAttribute(
-                            "class", rowKlass.replaceAll("selected", "").trim());
-                    });
-                }
-                tablerow.setAttribute("class", `${tableclass} selected`);
-            }
-            else {
-                tablerow.setAttribute(
-                    "class", tableclass.replaceAll("selected", "").trim());
-            }
-        });
-    });
-};
-
-
-var toggleCheck = (checkboxOrRadio) => {
-    if (checkboxOrRadio.length > 0) {
-        var currentState = checkboxOrRadio.prop("checked");
-        var newState = !currentState;
-        if (currentState == true && checkboxOrRadio.attr("type").toLowerCase() == "radio") {
-            // We don't want to toggle from true to false by clicking on the row
-            // if it is a radio button.
-            newState = currentState;
-        }
-        checkboxOrRadio.prop("checked", newState);
-        checkboxOrRadio.trigger("change");
-    }
-};
-
-
-var dtAddRowClickHandler = (tableId) => {
-    $(tableId).on("draw.dt", (event) => {
-        $(tableId + " tbody tr").on("click", (event) => {
-            var row = event.target.closest("tr");
-            var checkboxOrRadio = $(row).find(".chk-row-select");
-            toggleCheck(checkboxOrRadio);
-        });
-    });
-};
-
-
-var dtAddCommonHandlers = (tableId) => {
-    dtAddRowSelectionHandler(tableId);
-    dtAddRowClickHandler(tableId);
-};
-
 var addTableLength = (menuList, lengthToAdd, dataLength) => {
     if(dataLength >= lengthToAdd) {
         newList = structuredClone(menuList);//menuList.slice(0, menuList.length); // shallow copy
diff --git a/uploader/static/js/populations.js b/uploader/static/js/populations.js
index 73e298a..be1231f 100644
--- a/uploader/static/js/populations.js
+++ b/uploader/static/js/populations.js
@@ -1,5 +1,4 @@
 $(() => {
-    dtAddCommonHandlers("#tbl-select-population");
     var populationsDataTable = buildDataTable(
         "#tbl-select-population",
         JSON.parse(
diff --git a/uploader/static/js/species.js b/uploader/static/js/species.js
index c1374c6..9ea3017 100644
--- a/uploader/static/js/species.js
+++ b/uploader/static/js/species.js
@@ -1,5 +1,4 @@
 $(() => {
-    dtAddCommonHandlers("#tbl-select-species");
     var speciesDataTable = buildDataTable(
         "#tbl-select-species",
         JSON.parse(
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html
index f171483..3ab8004 100644
--- a/uploader/templates/phenotypes/view-dataset.html
+++ b/uploader/templates/phenotypes/view-dataset.html
@@ -65,11 +65,7 @@
 
 
 <div class="row">
-  <div style="padding-bottom: 0.5em;">
-    <a href="#" class="btn btn-info" id="btn-phenotypes-list-select-all">select all</a>
-    <a href="#" class="btn btn-info" id="btn-phenotypes-list-deselect-all">deselect all</a>
-    <a href="#" class="btn btn-info" id="btn-phenotypes-list-edit">edit</a>
-  </div>
+
   <table id="tbl-phenotypes-list" class="table compact stripe cell-border">
     <thead>
       <tr>
@@ -93,8 +89,6 @@
 {%block javascript%}
 <script type="text/javascript">
   $(function() {
-      dtAddCommonHandlers("#tbl-phenotypes-list");
-
       var data = {{phenotypes | tojson}};
       var dtPhenotypesList = buildDataTable(
           "#tbl-phenotypes-list",
@@ -137,20 +131,6 @@
                   return `${pheno.InbredSetCode}_${pheno.xref_id}`;
               }
           });
-
-      $("#btn-phenotypes-list-select-all").on("click", (event) => {
-          dtPhenotypesList.rows().select();
-          dtPhenotypesList.rows().nodes().each((node, idx) => {
-              $(node).find(".chk-row-select").prop("checked", true);
-          });
-      });
-
-      $("#btn-phenotypes-list-deselect-all").on("click", (event) => {
-          dtPhenotypesList.rows().deselect();
-          dtPhenotypesList.rows().nodes().each((node, idx) => {
-              $(node).find(".chk-row-select").prop("checked", false);
-          });
-      });
   });
 </script>
 {%endblock%}