diff options
| author | Frederick Muriuki Muriithi | 2025-12-29 10:55:01 -0600 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2025-12-29 10:55:01 -0600 |
| commit | c9b3db62655eb31d2229aba988b86da666163329 (patch) | |
| tree | dea39a3a06384b3cc6a4c5d86b5b1957bcbf4ca9 /uploader | |
| parent | ab9a4a21e4b5a815b9c6dfd465d54e6df27d7364 (diff) | |
| download | gn-uploader-c9b3db62655eb31d2229aba988b86da666163329.tar.gz | |
Species: Move feature to new UI templates.
Diffstat (limited to 'uploader')
| -rw-r--r-- | uploader/species/views.py | 4 | ||||
| -rw-r--r-- | uploader/templates/species/base.html | 19 | ||||
| -rw-r--r-- | uploader/templates/species/sui-base.html | 10 | ||||
| -rw-r--r-- | uploader/templates/species/sui-view-species.html | 127 | ||||
| -rw-r--r-- | uploader/templates/species/view-species.html | 171 |
5 files changed, 111 insertions, 220 deletions
diff --git a/uploader/species/views.py b/uploader/species/views.py index 9b14d01..4bfa7ae 100644 --- a/uploader/species/views.py +++ b/uploader/species/views.py @@ -8,8 +8,6 @@ from flask import (flash, Blueprint, current_app as app) -from uploader.sui import sui_template - from uploader.population import popbp from uploader.platforms import platformsbp from uploader.flask_extensions import url_for @@ -56,7 +54,7 @@ def view_species(species_id: int): species_id=species_id, population_id=population["Id"])) return render_template( - sui_template("species/view-species.html"), + "species/view-species.html", species=species, activelink="view-species", populations=populations_by_species(conn, species["SpeciesId"])) diff --git a/uploader/templates/species/base.html b/uploader/templates/species/base.html index f64f72b..a7c1a8f 100644 --- a/uploader/templates/species/base.html +++ b/uploader/templates/species/base.html @@ -1,17 +1,10 @@ {%extends "base.html"%} -{%block lvl1_breadcrumbs%} -<li {%if activelink=="species"%} - class="breadcrumb-item active" - {%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%} +{%block breadcrumbs%} +{{super()}} +<li class="breadcrumb-item"> + <a href="{{url_for('species.view_species', species_id=species['SpeciesId'])}}"> + {{species["Name"]|title}} + </a> </li> -{%block lvl2_breadcrumbs%}{%endblock%} {%endblock%} diff --git a/uploader/templates/species/sui-base.html b/uploader/templates/species/sui-base.html deleted file mode 100644 index f7b4fef..0000000 --- a/uploader/templates/species/sui-base.html +++ /dev/null @@ -1,10 +0,0 @@ -{%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 deleted file mode 100644 index 4b6402e..0000000 --- a/uploader/templates/species/sui-view-species.html +++ /dev/null @@ -1,127 +0,0 @@ -{%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 2d02f7e..48fd6cc 100644 --- a/uploader/templates/species/view-species.html +++ b/uploader/templates/species/view-species.html @@ -1,90 +1,127 @@ {%extends "species/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%} -{%block pagetitle%}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 lvl2_breadcrumbs%} -<li {%if activelink=="view-species"%} - class="breadcrumb-item active" - {%else%} - class="breadcrumb-item" - {%endif%}> - <a href="{{url_for('species.view_species', species_id=species.SpeciesId)}}">View</a> -</li> -{%endblock%} {%block contents%} -{{flash_all_messages()}} <div class="row"> - <h2>Details on species {{species.FullName}}</h2> + <h2 class="heading">{{species.FullName}} ({{species.Name}})</h2> +</div> - <dl> - <dt>Common Name</dt> - <dd>{{species.SpeciesName}}</dd> +<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> - <dt>Scientific Name</dt> - <dd>{{species.FullName}}</dd> +<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> - <dt>Taxonomy ID</dt> - <dd>{{species.TaxonomyId}}</dd> - </dl> + <form method="GET" + action="{{url_for('species.view_species', species_id=species.SpeciesId)}}" + class="form-horizontal"> + {{add_http_feature_flags()}} + {{add_form_buttons()}} - <h3>Actions</h3> + {%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> - <p> - You can proceed to perform any of the following actions for species - {{species.FullName}} - </p> + <tbody></tbody> + </table> + </div> - <ol> - <li> - <a href="{{url_for('species.populations.list_species_populations', - species_id=species.SpeciesId)}}" - 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> + {%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="card"> - <div class="card-body"> - <h5 class="card-title">Species Extras</h5> - <div class="card-text"> - <p>Some extra internal-use details (mostly for UI concerns on GeneNetwork)</p> - <p> - <small> - If you do not understand what the following are about, simply ignore them - — - They have no bearing whatsoever on your data, or its analysis. - </small> - </p> - <dl> - <dt>Family</dt> - <dd>{{species.Family}}</dd> +<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%} - <dt>FamilyOrderId</dt> - <dd>{{species.FamilyOrderId}}</dd> - <dt>OrderId</dt> - <dd>{{species.OrderId}}</dd> - </dl> - </div> - <a href="{{url_for('species.edit_species_extra', - species_id=species.SpeciesId)}}" - class="card-link" - title="Edit the species' internal-use details.">Edit</a> - </div> -</div> +{%block javascript%} +<script type="text/javascript" src="/static/js/populations.js"></script> {%endblock%} |
