about summary refs log tree commit diff
path: root/uploader/templates/species
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/species')
-rw-r--r--uploader/templates/species/base.html5
-rw-r--r--uploader/templates/species/create-species.html112
-rw-r--r--uploader/templates/species/list-species.html2
-rw-r--r--uploader/templates/species/macro-display-species-card.html47
-rw-r--r--uploader/templates/species/macro-select-species.html85
-rw-r--r--uploader/templates/species/sui-base.html10
-rw-r--r--uploader/templates/species/sui-view-species.html127
-rw-r--r--uploader/templates/species/view-species.html6
8 files changed, 307 insertions, 87 deletions
diff --git a/uploader/templates/species/base.html b/uploader/templates/species/base.html
index 04391db..f64f72b 100644
--- a/uploader/templates/species/base.html
+++ b/uploader/templates/species/base.html
@@ -6,7 +6,12 @@
     {%else%}
     class="breadcrumb-item"
     {%endif%}>
+  {%if species is mapping%}
+  <a href="{{url_for('species.view_species', species_id=species.SpeciesId)}}">
+    {{species.Name}}</a>
+  {%else%}
   <a href="{{url_for('species.list_species')}}">Species</a>
+  {%endif%}
 </li>
 {%block lvl2_breadcrumbs%}{%endblock%}
 {%endblock%}
diff --git a/uploader/templates/species/create-species.html b/uploader/templates/species/create-species.html
index 0d0bedf..138dbaa 100644
--- a/uploader/templates/species/create-species.html
+++ b/uploader/templates/species/create-species.html
@@ -19,72 +19,88 @@
 <div class="row">
   <form id="frm-create-species"
         method="POST"
-        action="{{url_for('species.create_species')}}">
+        action="{{url_for('species.create_species', return_to=return_to)}}"
+        class="form-horizontal">
     <legend>Create Species</legend>
 
     {{flash_all_messages()}}
 
+    <input type="hidden" name="return_to" value="{{return_to}}">
+
     <div class="form-group">
-      <label for="txt-taxonomy-id" class="form-label">
+      <label for="txt-taxonomy-id" class="control-label col-sm-2">
         Taxonomy ID</label>
-      <div class="input-group">
-        <input id="txt-taxonomy-id"
-               name="species_taxonomy_id"
-               type="text"
-               class="form-control" />
-        <span class="input-group-btn">
-          <button id="btn-search-taxonid" class="btn btn-info">Search</button>
-        </span>
+      <div class="col-sm-10">
+        <div class="input-group">
+          <input id="txt-taxonomy-id"
+                 name="species_taxonomy_id"
+                 type="text"
+                 class="form-control" />
+          <span class="input-group-btn">
+            <button id="btn-search-taxonid" class="btn btn-info">Search</button>
+          </span>
+        </div>
+        <small class="form-text text-small text-muted">
+          Use
+          <a href="https://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/"
+             title="NCBI's Taxonomy Browser homepage"
+             target="_blank">
+            NCBI's Taxonomy Browser homepage</a> to search for the species you
+          want. If the species exists on NCBI, they will have a Taxonomy ID. Copy
+          that Taxonomy ID to this field, and click "Search" to auto-fill the
+          details.<br />
+          This field is optional.</small>
       </div>
-      <small class="form-text text-small text-muted">Provide the taxonomy ID for
-        your species that can be used to link to external sites like NCBI. Enter
-        the taxonomy ID and click "Search" to auto-fill the form with data.
-        <br />
-        While it is recommended to provide a value for this field, doing so is
-        optional.
-      </small>
     </div>
 
     <div class="form-group">
-      <label for="txt-species-name" class="form-label">Common Name</label>
-      <input id="txt-species-name"
-             name="common_name"
-             type="text"
-             class="form-control"
-             required="required" />
-      <small class="form-text text-muted">Provide the common, possibly
-        non-scientific name for the species here, e.g. Human, Mouse, etc.</small>
+      <label for="txt-species-name" class="control-label col-sm-2">Common Name</label>
+      <div class="col-sm-10">
+        <input id="txt-species-name"
+               name="common_name"
+               type="text"
+               class="form-control"
+               required="required" />
+        <small class="form-text text-muted">This is the day-to-day term used by
+          laymen, e.g. Mouse (instead of Mus musculus), round worm (instead of
+          Ascaris lumbricoides), etc.<br />
+          For species without this, just enter the scientific name.
+        </small>
+      </div>
     </div>
 
     <div class="form-group">
-      <label for="txt-species-scientific" class="form-label">
+      <label for="txt-species-scientific" class="control-label col-sm-2">
         Scientific Name</label>
-      <input id="txt-species-scientific"
-             name="scientific_name"
-             type="text"
-             class="form-control"
-             required="required" />
-      <small class="form-text text-muted">Provide the scientific name for the
-        species you are creating, e.g. Homo sapiens, Mus musculus, etc.</small>
+      <div class="col-sm-10">
+        <input id="txt-species-scientific"
+               name="scientific_name"
+               type="text"
+               class="form-control"
+               required="required" />
+        <small class="form-text text-muted">This is the scientific name for the
+          species e.g. Homo sapiens, Mus musculus, etc.</small>
+      </div>
     </div>
 
     <div class="form-group">
-      <label for="select-species-family" class="form-label">Family</label>
-      <select id="select-species-family"
-              name="species_family"
-              required="required"
-              class="form-control">
-        <option value="">Please select a grouping</option>
-        {%for family in families%}
-        <option value="{{family}}">{{family}}</option>
-        {%endfor%}
-      </select>
-      <small class="form-text text-muted">
-        This is a generic grouping for the species that determines under which
-        grouping the species appears in the GeneNetwork menus</small>
+      <label for="select-species-family" class="control-label col-sm-2">Family</label>
+      <div class="col-sm-10">
+        <select id="select-species-family"
+                name="species_family"
+                required="required"
+                class="form-control">
+          <option value="ungrouped">I do not know what to pick</option>
+          {%for family in families%}
+          <option value="{{family}}">{{family}}</option>
+          {%endfor%}
+        </select>
+        <small class="form-text text-muted">
+          This is a rough grouping of the species.</small>
+      </div>
     </div>
 
-    <div class="form-group">
+    <div class="col-sm-offset-2 col-sm-10">
       <input type="submit"
              value="create new species"
              class="btn btn-primary" />
@@ -113,7 +129,7 @@
               }
               msg = (
                   "Request to '${uri}' failed with message '${textStatus}'. "
-                  + "Please try again later, or fill the details manually.");
+                      + "Please try again later, or fill the details manually.");
               alert(msg);
               console.error(msg, data, textStatus);
               return false;
diff --git a/uploader/templates/species/list-species.html b/uploader/templates/species/list-species.html
index 85c9d40..64084b0 100644
--- a/uploader/templates/species/list-species.html
+++ b/uploader/templates/species/list-species.html
@@ -29,7 +29,7 @@
     <caption>Available Species</caption>
     <thead>
       <tr>
-        <th>#</td>
+        <th></td>
         <th title="A common, layman's name for the species.">Common Name</th>
         <th title="The scientific name for the species">Organism Name</th>
         <th title="An identifier for the species in the NCBI taxonomy database">
diff --git a/uploader/templates/species/macro-display-species-card.html b/uploader/templates/species/macro-display-species-card.html
index 857c0f0..30c564f 100644
--- a/uploader/templates/species/macro-display-species-card.html
+++ b/uploader/templates/species/macro-display-species-card.html
@@ -3,14 +3,49 @@
   <div class="card-body">
     <h5 class="card-title">Species</h5>
     <div class="card-text">
-      <dl>
-        <dt>Common Name</dt>
-        <dd>{{species.SpeciesName}}</dd>
+      <table class="table">
+        <tbody>
+          <tr>
+            <td>Common Name</td>
+            <td>{{species.SpeciesName}}</td>
+          </tr>
 
-        <dt>Scientific Name</dt>
-        <dd>{{species.FullName}}</dd>
-      </dl>
+          <tr>
+            <td>Scientific Name</td>
+            <td>{{species.FullName}}</td>
+          </tr>
+        </tbody>
+      </table>
     </div>
   </div>
 </div>
 {%endmacro%}
+
+
+{%macro display_sui_species_card(species)%}
+<div class="row">
+  <table class="table">
+    <caption>Current Species</caption>
+    <tbody>
+      <tr>
+        <th>Name</th>
+        <td>{{species["Name"] | title}}</td>
+      </tr>
+      <tr>
+        <th>Scientific</th>
+        <td>{{species["FullName"]}}</td>
+      </tr>
+      {%if species["TaxonomyId"]%}
+      <tr>
+        <th>Taxonomy ID</th>
+        <td>
+          <a href="https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id={{species.TaxonomyId}}"
+             title="NCBI's Taxonomy Browser page for {{species.Name}}">
+            {{species.TaxonomyId}}</a>
+        </td>
+      </tr>
+    </tbody>
+    {%endif%}
+  </table>
+</div>
+{%endmacro%}
diff --git a/uploader/templates/species/macro-select-species.html b/uploader/templates/species/macro-select-species.html
index 6955134..3714ae4 100644
--- a/uploader/templates/species/macro-select-species.html
+++ b/uploader/templates/species/macro-select-species.html
@@ -1,38 +1,59 @@
+{%from "macro-step-indicator.html" import step_indicator%}
+
 {%macro select_species_form(form_action, species)%}
-{%if species | length > 0%}
-<form method="GET" action="{{form_action}}">
-  <legend>Select Species</legend>
-
-  <div class="form-group">
-    <label for="select-species" class="form-label">Species</label>
-    <select id="select-species"
-            name="species_id"
-            class="form-control"
-            required="required">
-      <option value="">Select Species</option>
-      {%for group in species%}
-      {{group}}
-      <optgroup {%if group[0][1] is not none%}
-                label="{{group[0][1].capitalize()}}"
-                {%else%}
-                label="Undefined"
-                {%endif%}>
-        {%for aspecies in group[1]%}
-        <option value="{{aspecies.SpeciesId}}">{{aspecies.MenuName}}</option>
-        {%endfor%}
-      </optgroup>
-      {%endfor%}
-    </select>
+<form method="GET" action="{{form_action}}" class="form-horizontal">
+
+  <h2>{{step_indicator("1")}} What species do you want to work with?</h2>
+
+  {%if species | length != 0%}
+
+  <p class="form-text">Search for, and select the species from the table below
+    and click "Continue"</p>
+
+  <div class="radio">
+    <label for="rdo-cant-find-species"
+           style="font-weight: 1;">
+      <input id="rdo-cant-find-species" type="radio" name="species_id"
+             value="CREATE-SPECIES" />
+      I could not find the species I want (create it).
+    </label>
   </div>
 
-  <div class="form-group">
-    <input type="submit" value="Select" class="btn btn-primary" />
+  <div class="col-sm-offset-10 col-sm-2">
+    <input type="submit"
+           class="btn btn-primary"
+           value="continue" />
   </div>
+
+  <div style="margin-top:3em;">
+    <table id="tbl-select-species" class="table compact stripe"
+           data-species-list='{{species | tojson}}'>
+      <div class="">
+        <thead>
+          <tr>
+            <th></th>
+            <th>Species Name</th>
+          </tr>
+        </thead>
+
+        <tbody></tbody>
+    </table>
+    </div>
+
+    {%else%}
+
+    <label class="control-label" for="rdo-cant-find-species">
+      <input id="rdo-cant-find-species" type="radio" name="species_id"
+             value="CREATE-SPECIES" />
+      There are no species to select from. Create the first one.</label>
+
+    <div class="col-sm-offset-10 col-sm-2">
+      <input type="submit"
+             class="btn btn-primary col-sm-offset-1"
+             value="continue" />
+    </div>
+
+    {%endif%}
+
 </form>
-{%else%}
-<p class="text-danger">
-  <span class="glyphicon glyphicon-exclamation-mark"></span>
-  We could not find species to select from!
-</p>
-{%endif%}
 {%endmacro%}
diff --git a/uploader/templates/species/sui-base.html b/uploader/templates/species/sui-base.html
new file mode 100644
index 0000000..f7b4fef
--- /dev/null
+++ b/uploader/templates/species/sui-base.html
@@ -0,0 +1,10 @@
+{%extends "sui-base.html"%}
+
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
+  <a href="{{url_for('species.view_species', species_id=species['SpeciesId'])}}">
+    {{species["Name"]|title}}
+  </a>
+</li>
+{%endblock%}
diff --git a/uploader/templates/species/sui-view-species.html b/uploader/templates/species/sui-view-species.html
new file mode 100644
index 0000000..4b6402e
--- /dev/null
+++ b/uploader/templates/species/sui-view-species.html
@@ -0,0 +1,127 @@
+{%extends "species/sui-base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+{%from "macro-forms.html" import add_http_feature_flags%}
+{%from "macro-step-indicator.html" import step_indicator%}
+{%from "species/macro-display-species-card.html" import display_sui_species_card%}
+
+{%block title%}View Species{%endblock%}
+
+{%macro add_form_buttons()%}
+<div class="row form-buttons">
+  <div class="col">
+    <input type="submit"
+           value="use selected population"
+           class="btn btn-primary" />
+  </div>
+
+  <div class="col">
+    <a href="url_for('species.population.create_population',
+             species_id=species.SpeciesId,
+             return_to='species.view_species')"
+       title="Create a new population for species '{{species.Name}}'."
+       class="btn btn-outline-info">
+      Create a new population
+    </a>
+  </div>
+</div>
+{%endmacro%}
+
+
+{%block contents%}
+<div class="row">
+  <h2 class="heading">{{species.FullName}} ({{species.Name}})</h2>
+</div>
+
+<div class "row">
+  <ul class="nav nav-tabs" id="species-actions">
+    <li class="nav-item presentation">
+      <button class="nav-link active"
+              id="populations-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#populations-content"
+              type="button"
+              role="tab"
+              aria-controls="populations-content"
+              aria-selected="true">Populations</button>
+    </li>
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="sequencing-platforms-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#sequencing-platforms-content"
+              type="button"
+              role="tab"
+              aria-controls="sequencing-platforms-content"
+              aria-selected="true">Sequencing Platforms</button>
+    </li>
+  </ul>
+</div>
+
+<div class="row">
+  <div class="tab-content" id="species-tabs-content">
+    <div class="tab-pane fade show active"
+         id="populations-content"
+         role="tabpanel"
+         aria-labelledby="populations-content-tab">
+      <p>Data belonging to a particular species is further divided into one or more
+        populations for easier handling. Please select the population you want to work
+        with.</p>
+
+      <form method="GET"
+            action="{{url_for('species.view_species', species_id=species.SpeciesId)}}"
+            class="form-horizontal">
+        {{add_http_feature_flags()}}
+        {{add_form_buttons()}}
+
+        {%if populations | length != 0%}
+        <div style="margin-top:0.3em;">
+          <table id="tbl-select-population" class="table compact stripe"
+                 data-populations-list='{{populations | tojson}}'>
+            <thead>
+              <tr>
+                <th></th>
+                <th>Population</th>
+              </tr>
+            </thead>
+
+            <tbody></tbody>
+          </table>
+        </div>
+
+        {%else%}
+        <p class="form-text">
+          There are no populations currently defined for {{species['FullName']}}
+          ({{species['SpeciesName']}}).</p>
+        {%endif%}
+
+        {{add_form_buttons()}}
+
+      </form>
+    </div>
+    <div class="tab-pane fade"
+         id="sequencing-platforms-content"
+         role="tabpanel"
+         aria-labelledby="sequencing-platforms-content-tab">
+      <p>Upload and manage the sequencing platforms for species
+        '{{species.Name | title}} ({{species.FullName}})'
+        <a href="{{url_for('species.platforms.list_platforms',
+                 species_id=species.SpeciesId)}}"
+           title="Manage sequencing platforms for {{species.Name}}">here</a>.
+      </p>
+    </div>
+  </div>
+</div>
+{%endblock%}
+
+{%block sidebarcontents%}
+<div class="row">
+  <p>You can manage species' populations and sequencing platforms here. Select
+    the tab for the feature you wish to continue working on.</p>
+</div>
+{{display_sui_species_card(species)}}
+{%endblock%}
+
+
+{%block javascript%}
+<script type="text/javascript" src="/static/js/populations.js"></script>
+{%endblock%}
diff --git a/uploader/templates/species/view-species.html b/uploader/templates/species/view-species.html
index b01864d..2d02f7e 100644
--- a/uploader/templates/species/view-species.html
+++ b/uploader/templates/species/view-species.html
@@ -45,6 +45,12 @@
          title="Create/Edit populations for {{species.FullName}}">
         Manage populations</a>
     </li>
+    <li>
+      <a href="{{url_for('species.platforms.list_platforms',
+               species_id=species.SpeciesId)}}"
+         title="Create/Edit sequencing platforms for {{species.FullName}}">
+        Manage sequencing platforms</a>
+    </li>
   </ol>