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.html107
1 files changed, 74 insertions, 33 deletions
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html
index 1fd15b2..fc84757 100644
--- a/uploader/templates/phenotypes/view-dataset.html
+++ b/uploader/templates/phenotypes/view-dataset.html
@@ -23,25 +23,12 @@
 {{flash_all_messages()}}
 
 <div class="row">
-  <p>The basic dataset details are:</p>
-
-  <table class="table">
-    <thead>
-      <tr>
-        <th>Name</th>
-        <th>Full Name</th>
-        <th>Short Name</th>
-      </tr>
-    </thead>
+  <h2>Phenotype Data</h2>
 
-    <tbody>
-      <tr>
-        <td>{{dataset.Name}}</td>
-        <td>{{dataset.FullName}}</td>
-        <td>{{dataset.ShortName}}</td>
-      </tr>
-    </tbody>
-  </table>
+  <p>Click on any of the phenotypes in the table below to view and edit that
+    phenotype's data.</p>
+  <p>Use the search to filter through all the phenotypes and find specific
+    phenotypes of interest.</p>
 </div>
 
 <div class="row">
@@ -67,7 +54,7 @@
       <input type="submit"
              title="Compute/Recompute the means for all phenotypes."
              class="btn btn-info"
-             value="(rec/c)ompute means"
+             value="compute means"
              id="submit-frm-recompute-phenotype-means" />
     </form>
   </div>
@@ -85,24 +72,29 @@
       <input type="submit"
              title="Run/Rerun QTLReaper."
              class="btn btn-info"
-             value="(re)run QTLReaper"
+             value="run QTLReaper"
              id="submit-frm-rerun-qtlreaper" />
     </form>
   </div>
-</div>
-
-<div class="row">
-  <h2>Phenotype Data</h2>
 
-  <p>Click on any of the phenotypes in the table below to view and edit that
-    phenotype's data.</p>
-  <p>Use the search to filter through all the phenotypes and find specific
-    phenotypes of interest.</p>
+  <div class="col">
+    <form id="frm-delete-phenotypes"
+          method="POST"
+          action="{{url_for(
+                  'species.populations.phenotypes.delete_phenotypes',
+                  species_id=species['SpeciesId'],
+                  population_id=population['Id'],
+                  dataset_id=dataset['Id'])}}">
+      <input type="submit"
+             class="btn btn-danger"
+             id="btn-delete-phenotypes"
+             title="Delete phenotypes from this dataset. If no phenotypes are selected in the table, this will delete ALL the phenotypes."
+             value="delete phenotypes" />
+    </form>
+  </div>
 </div>
 
-
-<div class="row">
-
+<div class="row" style="margin-top: 0.5em;">
   <table id="tbl-phenotypes-list" class="table compact stripe cell-border">
     <thead>
       <tr>
@@ -156,14 +148,36 @@
                       return `<a href="${url.toString()}" target="_blank">` +
                           `${pheno.InbredSetCode}_${pheno.xref_id}` +
                           `</a>`;
-                  }
+                  },
+                  title: "Record",
+                  visible: true,
+                  searchable: true
               },
               {
                   data: function(pheno) {
                       return (pheno.Post_publication_description ||
                               pheno.Original_description ||
                               pheno.Pre_publication_description);
-                  }
+                  },
+                  title: "Description",
+                  visible: true,
+                  searchable: true
+              },
+              {
+                  data: function(pheno) {
+                      return pheno.publication.Title;
+                  },
+                  title: "Publication Title",
+                  visible: false,
+                  searchable: true
+              },
+              {
+                  data: function(pheno) {
+                      return pheno.publication.Authors;
+                  },
+                  title: "Authors",
+                  visible: false,
+                  searchable: true
               }
           ],
           {
@@ -202,6 +216,33 @@
               });
               form.submit();
           });
+
+      $("#btn-delete-phenotypes").on(
+          "click",
+          function(event) {
+              // Collect selected phenotypes for deletion, if any.
+              event.preventDefault();
+              form = $("#frm-delete-phenotypes");
+              form.find(".dynamically-added-element").remove();
+              $("#tbl-phenotypes-list")
+                  .DataTable()
+                  .rows({selected: true}).
+                  nodes().each(function(node, index) {
+                      var parts = $(node)
+                          .find(".chk-row-select")
+                          .val()
+                          .split("_");
+                      var xref_id = parts[parts.length - 1].trim();
+                      var chk = $('<input type="checkbox">');
+                      chk.attr("class", "dynamically-added-element");
+                      chk.attr("value", xref_id);
+                      chk.attr("name", "xref_ids");
+                      chk.attr("style", "display: none");
+                      chk.prop("checked", true);
+                      form.append(chk);
+                  });
+              form.submit();
+          });
   });
 </script>
 {%endblock%}