Skip to content

Commit

Permalink
improve taxon detail
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed Aug 1, 2023
1 parent 2c809d2 commit 04bf18a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 21 deletions.
79 changes: 60 additions & 19 deletions apptax/admin/templates/admin/details_taxref.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
<div class="row">
<div class="card col-10">
<div class="card-body">
<h5 class="card-title"> {{model.nom_complet}} {% if model.nom_vern %} - {{model.nom_vern}} {% endif %} </h5>
<h5 class="card-title"> </h5>
<div class="row">
<h5 class="col-11 card-title"> {{model.nom_complet}} {% if model.nom_vern %} - {{model.nom_vern}} {% endif %} </h5>
<h5 class="card-title col-1">
<a href="https://inpn.mnhn.fr/espece/cd_nom/{{model.cd_nom }}">
<img width="100" src="{{url_for("static", filename="logo_inpn.png")}}" alt="">
</a>
</h5>
</div>
<div class="card-subtitle mb-2 text-muted" id="taxonomie-hierarchy">
{{ model.phylum }}
{% if model.classe %} > {% endif %}
Expand All @@ -30,9 +36,37 @@ <h5 class="card-title"> </h5>
<a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-lists" role="tab" aria-controls="nav-lists" aria-selected="false">Listes</a>
<a class="nav-item nav-link" id="nav-attributes-tab" data-toggle="tab" href="#nav-attributes" role="tab" aria-controls="nav-attributes" aria-selected="false">Attributs</a>
<a class="nav-item nav-link" id="nav-medias-tab" data-toggle="tab" href="#nav-medias" role="tab" aria-controls="nav-medias" aria-selected="false">Médias</a>
<a class="nav-item nav-link" id="nav-status-tab" data-toggle="tab" href="#nav-status" role="tab" aria-controls="nav-status" aria-selected="false">Status</a>
<a class="nav-item nav-link" id="nav-synonymes-tab" data-toggle="tab" href="#nav-synonymes" role="tab" aria-controls="nav-synonymes" aria-selected="false">Synonymes</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade mt-2" id="nav-status" role="tabpanel" aria-labelledby="nav-status-tab">
{% for statut in model.status %}
<div class="alert alert-success">
{{statut.lb_type_statut}}
</div>
<b> {{statut.full_citation}} </b>
<p>
<b>Portée : </b> {{statut.niveau_admin}} - {{statut.cd_sig}} <br>
<b>Niveau : </b> {{statut.niveau_admin}} - {{statut.label_statut}} <br>
<a href="{{statut.doc_url}}"> Voir le texte</a>
</p>
{% if statut.doc_url %}
{% endif %}

{% endfor %}
</div>
<div class="tab-pane fade mt-2" id="nav-synonymes" role="tabpanel" aria-labelledby="nav-synonymes-tab">
<table class="table table-striped mt-3">
{% for syn in model.synonymes %}
<tr>
<td class="col-5"> {{syn.nom_complet}} </td>
<td class="col-5"> <a href="{{APPLICATION_ROOT}}/admin/taxons/details/?id={{syn.cd_nom}}">{{syn.cd_nom}} </a> </td>
</tr>
{% endfor %}
</table>
</div>
<div class="tab-pane fade show active" id="nav-taxonomy" role="tabpanel" aria-labelledby="nav-taxonomy-tab">
<table class="table table-striped mt-3">
<tr>
Expand All @@ -43,6 +77,10 @@ <h5 class="card-title"> </h5>
<th class="col-5"> Nom vernaculaire</th>
<td class="col-5"> {{model.nom_vern}} </th>
</tr>
<tr>
<th class="col-5"> Auteur</th>
<td class="col-5"> {{model.lb_auteur}} </th>
</tr>
<tr>
<th class="col-5"> Nom vernaculaire anglais</th>
<td class="col-5"> {{model.nom_vern}} </th>
Expand All @@ -53,8 +91,14 @@ <h5 class="card-title"> </h5>
</tr>
<tr>
<th class="col-5"> cd_ref </th>
<td class="col-5"> {{model.cd_ref}} </th>
<td class="col-5"> <a href="{{APPLICATION_ROOT}}/admin/taxons/details/?id={{model.cd_ref}}"> {{model.cd_ref}}</a> </th>
</tr>
{% if model.cd_taxsup %}
<tr>
<th class="col-5"> Taxon superieur </th>
<td class="col-5"> <a href="{{APPLICATION_ROOT}}/admin/taxons/details/?id={{model.cd_taxsup}}"> {{model.cd_taxsup}}</a> </th>
</tr>
{% endif %}
<tr>
<th class="col-5"> Group 1 INPN </th>
<td class="col-5"> {{model.group1_inpn}} </th>
Expand All @@ -65,14 +109,13 @@ <h5 class="card-title"> </h5>
</tr>
<tr>
<th class="col-5"> Rang </th>
<td class="col-5"> {{model.id_rang}} </th>
</tr>
<td class="col-5"> {{model.rang.nom_rang}} </th>
</tr> <div class="tab-pane fade show active" id="nav-status" role="tabpanel" aria-labelledby="nav-status-tab">
</div>
</table>
<a href="https://inpn.mnhn.fr/espece/cd_nom/{{model.cd_nom }}">
<img width="100" src="{{url_for("static", filename="logo_inpn.png")}}" alt="">
</a>


</div>

<div class="tab-pane fade" id="nav-lists" role="tabpanel" aria-labelledby="nav-lists-tab">
{% for liste in model.liste %}
<table class="table table-striped mt-3">
Expand Down Expand Up @@ -106,8 +149,6 @@ <h5 class="card-title"> {{theme}} </h5>
{% endfor %}
</div>



<div class="tab-pane fade" id="nav-medias" role="tabpanel" aria-labelledby="nav-medias-tab">
<table class="table table-striped">
<thead>
Expand All @@ -133,15 +174,15 @@ <h5 class="card-title"> {{theme}} </h5>
{% endfor %}

</table>
{% for media in model.medias %}

{% endfor %}

</div>
</div>

</div>
<!-- END NAV CONTENT -->
<!-- <div class="tab-pane fade show active" id="nav-status" role="tabpanel" aria-labelledby="nav-status-tab">
HOP
</div> -->
</div>
</div>
</div>
</div>
</div>

Expand Down
12 changes: 10 additions & 2 deletions apptax/taxonomie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ class Taxref(db.Model):
url = db.Column(db.Unicode)

liste = db.relationship("BibListes", secondary=CorNomListe.__table__)
status = db.relationship("VBdcStatus")
rang = db.relationship("BibTaxrefRangs", uselist=False)
synonymes = db.relationship(
"Taxref",
lazy="joined",
foreign_keys=[cd_ref],
primaryjoin="Taxref.cd_ref == Taxref.cd_ref",
)

@hybrid_property
def nom_vern_or_lb_nom(self):
Expand Down Expand Up @@ -309,7 +317,7 @@ def __repr__(self):
class BibTaxrefRangs(db.Model):
__tablename__ = "bib_taxref_rangs"
__table_args__ = {"schema": "taxonomie"}
id_rang = db.Column(db.Integer, primary_key=True)
id_rang = db.Column(db.Integer, ForeignKey("taxonomie.taxref.id_rang"), primary_key=True)
nom_rang = db.Column(db.Unicode)
tri_rang = db.Column(db.Integer)

Expand Down Expand Up @@ -455,7 +463,7 @@ class TaxrefBdcStatutTaxon(db.Model):
class VBdcStatus(db.Model):
__tablename__ = "v_bdc_status"
__table_args__ = {"schema": "taxonomie", "info": dict(is_view=True)}
cd_nom = db.Column(db.Integer, primary_key=True)
cd_nom = db.Column(db.Integer, ForeignKey("taxonomie.taxref.cd_ref"), primary_key=True)
cd_ref = db.Column(db.Integer)
rq_statut = db.Column(db.Unicode)
code_statut = db.Column(db.Unicode, primary_key=True)
Expand Down

0 comments on commit 04bf18a

Please sign in to comment.