From fbf9a5c77768645568de2a96a82d25f18a61e0b0 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 10 Dec 2024 16:49:35 -0600 Subject: Retain population for "List Markers" page For UI consistency, and as a convenience to the users, retain the population details for the "List Markers" page to help them navigate more easily using the breadcrumbs. --- uploader/genotypes/views.py | 14 +++++++++++--- uploader/templates/genotypes/base.html | 10 +++++++--- uploader/templates/genotypes/list-genotypes.html | 3 ++- uploader/templates/genotypes/list-markers.html | 5 ++++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/uploader/genotypes/views.py b/uploader/genotypes/views.py index e6b1ba7..0433420 100644 --- a/uploader/genotypes/views.py +++ b/uploader/genotypes/views.py @@ -96,16 +96,24 @@ def list_genotypes(species: dict, population: dict, **kwargs):# pylint: disable= activelink="list-genotypes") -@genotypesbp.route("//genotypes/list-markers", methods=["GET"]) +@genotypesbp.route( + "//populations//genotypes/list-markers", + methods=["GET"]) @require_login -@with_species(redirect_uri="species.populations.genotypes.index") -def list_markers(species: dict, **kwargs):# pylint: disable=[unused-argument] +@with_population(species_redirect_uri="species.populations.genotypes.index", + redirect_uri="species.populations.genotypes.select_population") +def list_markers( + species: dict, + population: dict, + **kwargs +):# pylint: disable=[unused-argument] """List a species' genetic markers.""" with database_connection(app.config["SQL_URI"]) as conn: start_from = max(safe_int(request.args.get("start_from") or 0), 0) count = safe_int(request.args.get("count") or 20) return render_template("genotypes/list-markers.html", species=species, + population=population, total_markers=genotype_markers_count( conn, species["SpeciesId"]), start_from=start_from, diff --git a/uploader/templates/genotypes/base.html b/uploader/templates/genotypes/base.html index 56819e5..7d61312 100644 --- a/uploader/templates/genotypes/base.html +++ b/uploader/templates/genotypes/base.html @@ -6,11 +6,15 @@ {%else%} class="breadcrumb-item" {%endif%}> - {%if dataset is mapping%} + {%if population is mapping%} {{dataset.Name}} + population_id=population.Id)}}"> + {%if dataset is defined and dataset is mapping%} + {{dataset.Name}} + {%else%} + Genotypes + {%endif%} {%else%} Genotypes {%endif%} diff --git a/uploader/templates/genotypes/list-genotypes.html b/uploader/templates/genotypes/list-genotypes.html index 2dc0d51..0f074fd 100644 --- a/uploader/templates/genotypes/list-genotypes.html +++ b/uploader/templates/genotypes/list-genotypes.html @@ -26,7 +26,8 @@

There are a total of {{total_markers}} currently registered genetic markers for the "{{species.FullName}}" species. You can click this link to view the genetic markers . diff --git a/uploader/templates/genotypes/list-markers.html b/uploader/templates/genotypes/list-markers.html index 9198b44..a705ae3 100644 --- a/uploader/templates/genotypes/list-markers.html +++ b/uploader/templates/genotypes/list-markers.html @@ -13,7 +13,8 @@ class="breadcrumb-item" {%endif%}> List markers + species_id=species.SpeciesId, + population_id=population.Id)}}">List markers {%endblock%} @@ -30,6 +31,7 @@ {%if start_from > 0%} @@ -45,6 +47,7 @@ {%if start_from + count < total_markers%} Next -- cgit v1.2.3