about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-12-29 11:35:17 -0600
committerFrederick Muriuki Muriithi2025-12-29 11:35:17 -0600
commited59dc5180dcd84d7d3c9e5eda890ea2545242e3 (patch)
tree8d8af2730df44d4ad7d8002a21352c5b2bc1c0ae
parent8b2737c391834e8245c42e13b84c67ed2a0d942b (diff)
downloadgn-uploader-ed59dc5180dcd84d7d3c9e5eda890ea2545242e3.tar.gz
Populations: Move feature to new UI templates.
-rw-r--r--uploader/population/views.py5
-rw-r--r--uploader/templates/populations/base.html28
-rw-r--r--uploader/templates/populations/create-population.html18
-rw-r--r--uploader/templates/populations/macro-display-population-card.html3
-rw-r--r--uploader/templates/populations/sui-base.html12
-rw-r--r--uploader/templates/populations/sui-view-population.html127
-rw-r--r--uploader/templates/populations/view-population.html201
7 files changed, 135 insertions, 259 deletions
diff --git a/uploader/population/views.py b/uploader/population/views.py
index caee55b..795ce81 100644
--- a/uploader/population/views.py
+++ b/uploader/population/views.py
@@ -11,8 +11,6 @@ from flask import (flash,
                    Blueprint,
                    current_app as app)
 
-from uploader.sui import sui_template
-
 from uploader.samples.views import samplesbp
 from uploader.flask_extensions import url_for
 from uploader.oauth2.client import oauth2_post
@@ -244,5 +242,4 @@ def view_population(species_id: int, population_id: int):
                     dataset_phenotypes(conn, population["Id"], _dataset["Id"]))
             }
 
-        return render_template(sui_template("populations/view-population.html"),
-                               **_kwargs)
+        return render_template("populations/view-population.html", **_kwargs)
diff --git a/uploader/templates/populations/base.html b/uploader/templates/populations/base.html
index 9db8083..24cacc2 100644
--- a/uploader/templates/populations/base.html
+++ b/uploader/templates/populations/base.html
@@ -1,18 +1,20 @@
 {%extends "species/base.html"%}
+{%from "populations/macro-display-population-card.html" import display_sui_population_card%}
 
-{%block lvl2_breadcrumbs%}
-<li {%if activelink=="populations"%}
-    class="breadcrumb-item active"
-    {%else%}
-    class="breadcrumb-item"
-    {%endif%}>
-  {%if population is mapping%}
+{%block breadcrumbs%}
+{{super()}}
+{%if population%}
+<li class="breadcrumb-item">
   <a href="{{url_for('species.populations.view_population',
-           species_id=species.SpeciesId,
-           population_id=population.Id)}}">{{population.Name}}</a>
-  {%else%}
-  <a href="{{url_for('species.populations.index')}}">Populations</a>
-  {%endif%}
+           species_id=species['SpeciesId'],
+           population_id=population['Id'])}}">
+    {{population["Name"]}}
+  </a>
 </li>
-{%block lvl3_breadcrumbs%}{%endblock%}
+{%endif%}
+{%endblock%}
+
+
+{%block sidebarcontents%}
+{{display_sui_population_card(species, population)}}
 {%endblock%}
diff --git a/uploader/templates/populations/create-population.html b/uploader/templates/populations/create-population.html
index 007b6bf..d5359f5 100644
--- a/uploader/templates/populations/create-population.html
+++ b/uploader/templates/populations/create-population.html
@@ -1,20 +1,16 @@
 {%extends "populations/base.html"%}
 {%from "flash_messages.html" import flash_all_messages%}
-{%from "species/macro-select-species.html" import select_species_form%}
-{%from "species/macro-display-species-card.html" import display_species_card%}
 
 {%block title%}Create Population{%endblock%}
 
 {%block pagetitle%}Create Population{%endblock%}
 
-{%block lvl3_breadcrumbs%}
-<li {%if activelink=="create-population"%}
-    class="breadcrumb-item active"
-    {%else%}
-    class="breadcrumb-item"
-    {%endif%}>
+{%block breadcrumbs%}
+{{super()}}
+<li class="breadcrumb-item">
   <a href="{{url_for('species.populations.create_population',
-           species_id=species.SpeciesId)}}">create population</a>
+           species_id=species['SpeciesId'])}}">
+    create population</a>
 </li>
 {%endblock%}
 
@@ -263,7 +259,3 @@
   </form>
 </div>
 {%endblock%}
-
-{%block sidebarcontents%}
-{{display_species_card(species)}}
-{%endblock%}
diff --git a/uploader/templates/populations/macro-display-population-card.html b/uploader/templates/populations/macro-display-population-card.html
index 6b5f1e0..f3040ea 100644
--- a/uploader/templates/populations/macro-display-population-card.html
+++ b/uploader/templates/populations/macro-display-population-card.html
@@ -43,7 +43,7 @@
 
 {%macro display_sui_population_card(species, population)%}
 {{display_sui_species_card(species)}}
-
+{%if population%}
 <div class="row">
   <table class="table">
     <caption>Current population</caption>
@@ -75,4 +75,5 @@
     </tbody>
   </table>
 </div>
+{%endif%}
 {%endmacro%}
diff --git a/uploader/templates/populations/sui-base.html b/uploader/templates/populations/sui-base.html
deleted file mode 100644
index 0ca5c59..0000000
--- a/uploader/templates/populations/sui-base.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{%extends "species/sui-base.html"%}
-
-{%block breadcrumbs%}
-{{super()}}
-<li class="breadcrumb-item">
-  <a href="{{url_for('species.populations.view_population',
-           species_id=species['SpeciesId'],
-           population_id=population['Id'])}}">
-    {{population["Name"]}}
-  </a>
-</li>
-{%endblock%}
diff --git a/uploader/templates/populations/sui-view-population.html b/uploader/templates/populations/sui-view-population.html
deleted file mode 100644
index a35eac6..0000000
--- a/uploader/templates/populations/sui-view-population.html
+++ /dev/null
@@ -1,127 +0,0 @@
-{%extends "populations/sui-base.html"%}
-{%from "macro-step-indicator.html" import step_indicator%}
-{%from "populations/macro-display-population-card.html" import display_sui_population_card%}
-
-{%block contents%}
-<div class="row">
-  <h2 class="heading">{{population.FullName}} ({{population.Name}})</h2>
-</div>
-
-<div class="row">
-  <ul class="nav nav-tabs" id="population-actions">
-    <li class="nav-item presentation">
-      <button class="nav-link"
-              id="samples-tab"
-              data-bs-toggle="tab"
-              data-bs-target="#samples-content"
-              type="button"
-              role="tab"
-              aria-controls="samples-content"
-              aria-selected="true">Samples</button></li>
-    <li class="nav-item presentation">
-      <button class="nav-link active"
-              id="phenotypes-tab"
-              data-bs-toggle="tab"
-              data-bs-target="#phenotypes-content"
-              type="button"
-              role="tab"
-              aria-controls="phenotypes-content"
-              aria-selected="false">Phenotypes</button></li>
-    {%if view_under_construction%}
-    <li class="nav-item presentation">
-      <button class="nav-link"
-              id="genotypes-tab"
-              data-bs-toggle="tab"
-              data-bs-target="#genotypes-content"
-              type="button"
-              role="tab"
-              aria-controls="genotypes-content"
-              aria-selected="false">Genotypes</button></li>
-    <li class="nav-item presentation">
-      <button class="nav-link"
-              id="expression-data-tab"
-              data-bs-toggle="tab"
-              data-bs-target="#expression-data-content"
-              type="button"
-              role="tab"
-              aria-controls="expression-data-content"
-              aria-selected="false">Expression-Data</button></li>
-    {%endif%}
-  </ul>
-</div>
-
-<div class="row">
-  <div class="tab-content" id="populations-tabs-content">
-    <div class="tab-pane fade"
-         id="samples-content"
-         role="tabpanel"
-         aria-labelledby="samples-content-tab">
-      <p>Think of a <strong>"sample"</strong> as say a single case or individual
-        in the experiment. It could even be a single strain (where applicable).
-      </p>
-      <p>This is a convenience feature for when you want to upload phenotypes to
-        the system, but do not have the genotypes data ready yet.</p>
-      <a href="{{url_for('species.populations.samples.list_samples',
-               species_id=species.SpeciesId,
-               population_id=population.Id)}}"
-         title="View and upload samples for population '{{population['Name']}}'"
-         class="btn btn-primary">Manage Samples</a>
-    </div>
-
-    <div class="tab-pane fade show active"
-         id="phenotypes-content"
-         role="tabpanel"
-         aria-labelledby="phenotypes-content-tab">
-
-      <div class="row" style="margin-top: 1em;">
-        <h3> Phenotypes in  Population "{{population.FullName}} ({{population.Name}})"</h3>
-
-        <p>To view existing phenotype traits, or upload new ones, click the button below:</p>
-
-        <div class="row">
-          <div class="col">
-            <a href="{{url_for(
-                     'species.populations.phenotypes.list_datasets',
-                     species_id=species.SpeciesId,
-                     population_id=population.Id)}}"
-               title="View and upload phenotype traits"
-               class="btn btn-primary">Phenotypes</a>
-          </div>
-        </div>
-      </div>
-    </div>
-
-    <div class="tab-pane fade"
-         id="genotypes-content"
-         role="tabpanel"
-         aria-labelledby="genotypes-content-tab">
-      <p>This allows you to upload the data that concerns your genotypes.</p>
-      <p>Any samples/individuals/cases/strains that do not already exist in the
-        system will be added. This does not delete any existing data.</p>
-      <a href="{{url_for('species.populations.genotypes.list_genotypes',
-               species_id=species.SpeciesId,
-               population_id=population.Id)}}"
-         title="Upload genotype information for the '{{population.FullName}}' population of the '{{species.FullName}}' species."
-         class="btn btn-primary">upload genotypes</a>
-    </div>
-    <div class="tab-pane fade" id="expression-data-content" role="tabpanel" aria-labelledby="expression-data-content-tab">
-      <p>Upload expression data (mRNA data) for this population.</p>
-      <a href="#" title="" class="btn btn-primary">upload genotypes</a>
-    </div>
-  </div>
-</div>
-{%endblock%}
-
-{%block sidebarcontents%}
-<div class="row">
-  <p>Each tab presents a feature that's available at the population level.
-    Select the tab that allows you to continue with your task.</p>
-</div>
-{{display_sui_population_card(species, population)}}
-{%endblock%}
-
-
-
-
-{%block javascript%}
-{%endblock%}
diff --git a/uploader/templates/populations/view-population.html b/uploader/templates/populations/view-population.html
index 3b9661b..ac89bc7 100644
--- a/uploader/templates/populations/view-population.html
+++ b/uploader/templates/populations/view-population.html
@@ -1,104 +1,127 @@
 {%extends "populations/base.html"%}
-{%from "flash_messages.html" import flash_all_messages%}
-{%from "species/macro-select-species.html" import select_species_form%}
-{%from "species/macro-display-species-card.html" import display_species_card%}
-
-{%block title%}Populations{%endblock%}
-
-{%block pagetitle%}Populations{%endblock%}
-
-{%block lvl3_breadcrumbs%}
-<li {%if activelink=="view-population"%}
-    class="breadcrumb-item active"
-    {%else%}
-    class="breadcrumb-item"
-    {%endif%}>
-  <a href="{{url_for('species.populations.view_population',
-           species_id=species.SpeciesId,
-           population_id=population.InbredSetId)}}">view</a>
-</li>
-{%endblock%}
-
+{%from "macro-step-indicator.html" import step_indicator%}
+{%from "populations/macro-display-population-card.html" import display_sui_population_card%}
 
 {%block contents%}
 <div class="row">
-  <h2>Population Details</h2>
-
-  {{flash_all_messages()}}
-
-  <dl>
-    <dt>Name</dt>
-    <dd>{{population.Name}}</dd>
-
-    <dt>FullName</dt>
-    <dd>{{population.FullName}}</dd>
-
-    <dt>Code</dt>
-    <dd>{{population.InbredSetCode}}</dd>
-
-    <dt>Genetic Type</dt>
-    <dd>{{population.GeneticType}}</dd>
-
-    <dt>Family</dt>
-    <dd>{{population.Family}}</dd>
-
-    <dt>Information</dt>
-    <dd><a href="https://info.genenetwork.org/species/source.php?SpeciesName={{species.Name}}&InbredSetName={{population.Name}}"
-           title="Link to detailed information on this population."
-           target="_blank">Population Information</a></dd>
-  </dl>
+  <h2 class="heading">{{population.FullName}} ({{population.Name}})</h2>
 </div>
 
 <div class="row">
-  … maybe provide a way to organise populations in the same family here …
+  <ul class="nav nav-tabs" id="population-actions">
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="samples-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#samples-content"
+              type="button"
+              role="tab"
+              aria-controls="samples-content"
+              aria-selected="true">Samples</button></li>
+    <li class="nav-item presentation">
+      <button class="nav-link active"
+              id="phenotypes-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#phenotypes-content"
+              type="button"
+              role="tab"
+              aria-controls="phenotypes-content"
+              aria-selected="false">Phenotypes</button></li>
+    {%if view_under_construction%}
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="genotypes-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#genotypes-content"
+              type="button"
+              role="tab"
+              aria-controls="genotypes-content"
+              aria-selected="false">Genotypes</button></li>
+    <li class="nav-item presentation">
+      <button class="nav-link"
+              id="expression-data-tab"
+              data-bs-toggle="tab"
+              data-bs-target="#expression-data-content"
+              type="button"
+              role="tab"
+              aria-controls="expression-data-content"
+              aria-selected="false">Expression-Data</button></li>
+    {%endif%}
+  </ul>
 </div>
 
 <div class="row">
-  <h3>Actions</h3>
-
-  <p>
-    Click any of the following links to use this population in performing the
-    subsequent operations.
-  </p>
-
-  <nav class="nav">
-    <ul>
-      <li>
-        <a href="{{url_for('species.populations.samples.list_samples',
-                 species_id=species.SpeciesId,
-                 population_id=population.Id)}}"
-           title="Manage samples: Add new or delete existing.">
-          manage samples</a>
-      </li>
-      <li>
-        <a href="{{url_for('species.populations.genotypes.list_genotypes',
-                 species_id=species.SpeciesId,
-                 population_id=population.Id)}}"
-           title="Manage genotypes for {{species.FullName}}">Manage Genotypes</a>
-      </li>
-      <li>
-        <a href="{{url_for('species.populations.phenotypes.list_datasets',
-                 species_id=species.SpeciesId,
-                 population_id=population.Id)}}"
-           title="Manage phenotype data.">manage phenotype data</a>
-      </li>
-      <li>
-        <a href="#" title="Manage expression data"
-           class="not-implemented">manage expression data</a>
-      </li>
-      <li>
-        <a href="#" title="Manage individual data"
-           class="not-implemented">manage individual data</a>
-      </li>
-      <li>
-        <a href="#" title="Manage RNA-Seq data"
-           class="not-implemented">manage RNA-Seq data</a>
-      </li>
-    </ul>
-  </nav>
+  <div class="tab-content" id="populations-tabs-content">
+    <div class="tab-pane fade"
+         id="samples-content"
+         role="tabpanel"
+         aria-labelledby="samples-content-tab">
+      <p>Think of a <strong>"sample"</strong> as say a single case or individual
+        in the experiment. It could even be a single strain (where applicable).
+      </p>
+      <p>This is a convenience feature for when you want to upload phenotypes to
+        the system, but do not have the genotypes data ready yet.</p>
+      <a href="{{url_for('species.populations.samples.list_samples',
+               species_id=species.SpeciesId,
+               population_id=population.Id)}}"
+         title="View and upload samples for population '{{population['Name']}}'"
+         class="btn btn-primary">Manage Samples</a>
+    </div>
+
+    <div class="tab-pane fade show active"
+         id="phenotypes-content"
+         role="tabpanel"
+         aria-labelledby="phenotypes-content-tab">
+
+      <div class="row" style="margin-top: 1em;">
+        <h3> Phenotypes in  Population "{{population.FullName}} ({{population.Name}})"</h3>
+
+        <p>To view existing phenotype traits, or upload new ones, click the button below:</p>
+
+        <div class="row">
+          <div class="col">
+            <a href="{{url_for(
+                     'species.populations.phenotypes.list_datasets',
+                     species_id=species.SpeciesId,
+                     population_id=population.Id)}}"
+               title="View and upload phenotype traits"
+               class="btn btn-primary">Phenotypes</a>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="tab-pane fade"
+         id="genotypes-content"
+         role="tabpanel"
+         aria-labelledby="genotypes-content-tab">
+      <p>This allows you to upload the data that concerns your genotypes.</p>
+      <p>Any samples/individuals/cases/strains that do not already exist in the
+        system will be added. This does not delete any existing data.</p>
+      <a href="{{url_for('species.populations.genotypes.list_genotypes',
+               species_id=species.SpeciesId,
+               population_id=population.Id)}}"
+         title="Upload genotype information for the '{{population.FullName}}' population of the '{{species.FullName}}' species."
+         class="btn btn-primary">upload genotypes</a>
+    </div>
+    <div class="tab-pane fade" id="expression-data-content" role="tabpanel" aria-labelledby="expression-data-content-tab">
+      <p>Upload expression data (mRNA data) for this population.</p>
+      <a href="#" title="" class="btn btn-primary">upload genotypes</a>
+    </div>
+  </div>
 </div>
 {%endblock%}
 
 {%block sidebarcontents%}
-{{display_species_card(species)}}
+<div class="row">
+  <p>Each tab presents a feature that's available at the population level.
+    Select the tab that allows you to continue with your task.</p>
+</div>
+{{super()}}
+{%endblock%}
+
+
+
+
+{%block javascript%}
 {%endblock%}