about summary refs log tree commit diff
path: root/uploader/templates/phenotypes/view-dataset.html
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/phenotypes/view-dataset.html')
-rw-r--r--uploader/templates/phenotypes/view-dataset.html80
1 files changed, 53 insertions, 27 deletions
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html
index 38a4d11..6a261fc 100644
--- a/uploader/templates/phenotypes/view-dataset.html
+++ b/uploader/templates/phenotypes/view-dataset.html
@@ -46,12 +46,32 @@
 </div>
 
 <div class="row">
-  <p><a href="{{url_for('species.populations.phenotypes.add_phenotypes',
-              species_id=species.SpeciesId,
-              population_id=population.Id,
-              dataset_id=dataset.Id)}}"
-        title="Add a bunch of phenotypes"
-        class="btn btn-primary">Add phenotypes</a></p>
+  <div class="col">
+    <a href="{{url_for('species.populations.phenotypes.add_phenotypes',
+             species_id=species.SpeciesId,
+             population_id=population.Id,
+             dataset_id=dataset.Id)}}"
+       title="Add a bunch of phenotypes"
+       class="btn btn-primary">Add phenotypes</a>
+  </div>
+
+  <div class="col">
+    <form id="frm-recompute-phenotype-means"
+          method="POST"
+          action="{{url_for(
+                  'species.populations.phenotypes.recompute_means',
+                  species_id=species['SpeciesId'],
+                  population_id=population['Id'],
+                  dataset_id=dataset['Id'])}}"
+          class="d-flex flex-row align-items-center flex-wrap"
+          style="display: inline;">
+      <input type="submit"
+             title="Compute/Recompute the means for all phenotypes."
+             class="btn btn-info"
+             value="(rec/c)ompute means"
+             id="submit-frm-recompute-phenotype-means" />
+    </form>
+  </div>
 </div>
 
 <div class="row">
@@ -65,11 +85,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,20 +109,16 @@
 {%block javascript%}
 <script type="text/javascript">
   $(function() {
-      dtAddCommonHandlers("#tbl-phenotypes-list");
-
+      var species_id = {{species.SpeciesId}};
+      var population_id = {{population.Id}};
+      var dataset_id = {{dataset.Id}};
+      var dataset_name = "{{dataset.Name}}";
       var data = {{phenotypes | tojson}};
-      $("#tbl-phenotypes-list").DataTable({
-          responsive: true,
-          lengthMenu: [10, 25, 50, 100, 1000, data.length],
-          language: {
-              processing: "Processing results… Please wait.",
-              loadingRecord: "Loading phenotypes — Please wait.",
-              info: "_START_ to _END_ of _TOTAL_ phenotypes",
-              lengthMenu: "Show _MENU_ phenotypes",
-          },
-          data: data,
-          columns: [
+
+      var dtPhenotypesList = buildDataTable(
+          "#tbl-phenotypes-list",
+          data,
+          [
               {
                   data: function(pheno) {
                       return `<input type="checkbox" name="selected-phenotypes" `
@@ -117,7 +129,7 @@
               },
               {data: "sequence_number"},
               {
-                  data: function(pheno) {
+                  data: function(pheno, type, set, meta) {
                       var spcs_id = {{species.SpeciesId}};
                       var pop_id = {{population.Id}};
                       var dtst_id = {{dataset.Id}};
@@ -137,8 +149,22 @@
                               pheno.Pre_publication_description);
                   }
               }
-          ]
-      });
+          ],
+          {
+              select: "multi+shift",
+              layout: {
+                  top1Start: {
+                      pageLength: {
+                          text: "Show _MENU_ of _TOTAL_"
+                      }
+                  },
+                  topStart: "info",
+                  top1End: null
+              },
+              rowId: function(pheno) {
+                  return `${pheno.InbredSetCode}_${pheno.xref_id}`;
+              }
+          });
   });
 </script>
 {%endblock%}