about summary refs log tree commit diff
path: root/uploader/templates/populations
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/templates/populations')
-rw-r--r--uploader/templates/populations/create-population.html53
-rw-r--r--uploader/templates/populations/index.html4
-rw-r--r--uploader/templates/populations/list-populations.html2
-rw-r--r--uploader/templates/populations/macro-select-population.html73
4 files changed, 86 insertions, 46 deletions
diff --git a/uploader/templates/populations/create-population.html b/uploader/templates/populations/create-population.html
index b05ce37..007b6bf 100644
--- a/uploader/templates/populations/create-population.html
+++ b/uploader/templates/populations/create-population.html
@@ -37,12 +37,15 @@
 <div class="row">
   <form method="POST"
         action="{{url_for('species.populations.create_population',
-                species_id=species.SpeciesId)}}">
+                species_id=species.SpeciesId,
+                return_to=return_to)}}">
 
     <legend>Create Population</legend>
 
     {{flash_all_messages()}}
 
+    <input type="hidden" name="return_to" value="{{return_to}}">
+
     <div {%if errors.population_fullname%}
          class="form-group has-error"
          {%else%}
@@ -107,9 +110,12 @@
              value="{{error_values.population_code or ''}}"
              class="form-control" />
       <small class="form-text text-muted">
-        <p class="text-danger">
-          <span class="glyphicon glyphicon-exclamation-sign"></span>
-          What is this field is for? Confirm with Arthur and the rest.
+        <p class="form-text text-muted">
+          This is a 3-character code for your population, that is prepended to
+          the phenotype identifiers. e.g. For the "BXD Family" population, the
+          code is "BXD" and therefore, the phenotype identifiers for the
+          population look like the following examples: <em>BXD_10148</em>,
+          <em>BXD_10180</em>, <em>BXD_10197</em>, etc.
         </p>
       </small>
     </div>
@@ -148,24 +154,35 @@
          {%else%}
          class="form-group"
          {%endif%}>
-      <label for="select-population-family" class="form-label">Family</label>
-      <select id="select-population-family"
-              name="population_family"
-              class="form-control"
-              required="required">
-        <option value="">Please select a family</option>
+      <label for="txt-population-family" class="form-label">Family</label>
+      <input type="text"
+             id="txt-population-family"
+             name="population_family"
+             class="form-control"
+             list="families-list" />
+      <datalist id="families-list">
         {%for family in families%}
-        <option value="{{family}}"
-                {%if error_values.population_family == family%}
-                selected="selected"
-                {%endif%}>{{family}}</option>
+        <option value="{{family}}">{{family}}</option>
         {%endfor%}
-      </select>
+      </datalist>
       <small class="form-text text-muted">
         <p>
-          This is a rough grouping of the populations in GeneNetwork into lists
-          of common types of populations.
-        </p>
+          This is <strong>optional</strong> metadata. It is used to group
+          populations into "families" for presentation in the menus.
+          {%if families | length > 0%}
+          Examples of currently existing families are:
+          <ul>
+            {%for family in families[0:7]%}
+            <li>{{family}}</li>
+            {%endfor%}
+            <li>etc.</li>
+          </ul>
+          {%endif%}
+
+          You can
+          {%if families|length>0%} select from existing families, or {%endif%}
+          create a new family by typing in the input box above. You can also
+          leave the family blank.</p>
       </small>
     </div>
 
diff --git a/uploader/templates/populations/index.html b/uploader/templates/populations/index.html
index 4354e02..d2bee77 100644
--- a/uploader/templates/populations/index.html
+++ b/uploader/templates/populations/index.html
@@ -22,3 +22,7 @@
   {{select_species_form(url_for("species.populations.index"), species)}}
 </div>
 {%endblock%}
+
+{%block javascript%}
+<script type="text/javascript" src="/static/js/species.js"></script>
+{%endblock%}
diff --git a/uploader/templates/populations/list-populations.html b/uploader/templates/populations/list-populations.html
index 7c7145f..f780e94 100644
--- a/uploader/templates/populations/list-populations.html
+++ b/uploader/templates/populations/list-populations.html
@@ -51,7 +51,7 @@
     <caption>Populations for {{species.FullName}}</caption>
     <thead>
       <tr>
-        <th>#</th>
+        <th></th>
         <th>Name</th>
         <th>Full Name</th>
         <th>Description</th>
diff --git a/uploader/templates/populations/macro-select-population.html b/uploader/templates/populations/macro-select-population.html
index ef74ac3..14b0510 100644
--- a/uploader/templates/populations/macro-select-population.html
+++ b/uploader/templates/populations/macro-select-population.html
@@ -1,33 +1,52 @@
-{%macro select_population_form(form_action, populations)%}
+{%from "macro-step-indicator.html" import step_indicator%}
+
+{%macro select_population_form(form_action, species, populations)%}
 <form method="GET" action="{{form_action}}" class="form-horizontal">
-  <legend>Select Population</legend>
-
-  <div class="form-group">
-    <label for="select-population" class="control-label col-sm-2">
-      Population</label>
-    <div class="col-sm-10">
-      <select id="select-population"
-              name="population_id"
-              class="form-control"
-              required="required">
-        <option value="">Select Population</option>
-        {%for family in populations%}
-        <optgroup {%if family[0][1] is not none%}
-                  label="{{family[0][1]}}"
-                  {%else%}
-                  label="Undefined"
-                  {%endif%}>
-          {%for population in family[1]%}
-          <option value="{{population.Id}}">{{population.FullName}}</option>
-          {%endfor%}
-        </optgroup>
-        {%endfor%}
-      </select>
-    </div>
+
+  <h2>{{step_indicator("2")}} What population do you want to work with?</h2>
+
+  {%if populations | length != 0%}
+
+  <p class="form-text">Search for, and select the population from the table
+    below and click "Continue"</p>
+
+  <div class="radio">
+    <label class="control-label" for="rdo-cant-find-population">
+      <input type="radio" id="rdo-cant-find-population"
+             name="population_id" value="CREATE-POPULATION" />
+      I cannot find the population I want &mdash; create it!
+    </label>
+  </div>
+
+  <div class="col-sm-offset-10 col-sm-2">
+    <input type="submit" value="continue" class="btn btn-primary" />
+  </div>
+
+  <div style="margin-top: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>
 
-  <div class="col-sm-offset-2 col-sm-10">
-    <input type="submit" value="Select" class="btn btn-primary" />
+  {%else%}
+  <p class="form-text">
+    There are no populations currently defined for {{species['FullName']}}
+    ({{species['SpeciesName']}}).<br />
+    Click "Continue" to create the first!</p>
+  <input type="hidden" name="population_id" value="CREATE-POPULATION" />
+
+  <div class="col-sm-offset-10 col-sm-2">
+    <input type="submit" value="continue" class="btn btn-primary" />
   </div>
+  {%endif%}
+
 </form>
 {%endmacro%}