diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-06 21:36:19 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-06 21:36:19 +0200 |
| commit | 0cbdebb1b43dbb19bc672e5c4721e47cfa289149 (patch) | |
| tree | 5d83f3e440b35bca23062932f57e630810695897 | |
| parent | 434b2bed4cc873e8fb6f7b0d47817f52dbb75f4a (diff) | |
| download | Ishtar-0cbdebb1b43dbb19bc672e5c4721e47cfa289149.tar.bz2 Ishtar-0cbdebb1b43dbb19bc672e5c4721e47cfa289149.zip | |
✨ finds - relations between finds: sheet - sheet relations refactorings
5 files changed, 68 insertions, 43 deletions
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 0ae238d66..ac1ae4f05 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -26,6 +26,7 @@ {% with non_modif_treatments_count=item.non_modif_treatments_count %} {% with associated_treatment_files_count=item.associated_treatment_files_count %} +{% with display_relations=item|safe_or:"right_relations.count|left_relations.count"|safe_and_not:"right_relations_not_available"|safe_and_not:"left_relations_not_available" %} {% with can_view_container=permission_view_own_container|or_:permission_view_container %} {% with display_warehouse_treatments=item.container|or_:item.container_ref|or_:item.upstream_treatment|or_:item.downstream_treatment|or_:non_modif_treatments_count|or_:associated_treatment_files_count %} {% with dating_list=item|m2m_listing:"datings" %} @@ -51,6 +52,15 @@ {% trans "Archaeological context" %} </a> </li> + {% if display_relations %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-relations-tab" + data-toggle="tab" href="#{{window_id}}-relations" role="tab" + aria-controls="{{window_id}}-relations" aria-selected="false"> + {% trans "Relations" %} + </a> + </li> + {% endif %} <li class="nav-item"> <a class="nav-link" id="{{window_id}}-datations-tab" data-toggle="tab" href="#{{window_id}}-datations" role="tab" @@ -270,6 +280,15 @@ </div> </div> + {% if display_relations %} + <div class="tab-pane fade" id="{{window_id}}-relations" + role="tabpanel" aria-labelledby="{{window_id}}-relations-tab"> + {% with relation_url="/show-find/" %} + {% include "ishtar/blocks/sheet_relations.html" %} + {% endwith %} + </div> + {% endif %} + <div class="tab-pane fade" id="{{window_id}}-datations" role="tabpanel" aria-labelledby="{{window_id}}-datations-tab"> <h3>{% trans "Periods / Datings" %}</h3> @@ -326,7 +345,7 @@ {% endif %} </div> -{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} +{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} <script type='text/javascript'> $( "#{{window_id}}-tabs" ).on( "tabsactivate", function( event, ui ) { diff --git a/archaeological_finds/templates/ishtar/sheet_museum_find.html b/archaeological_finds/templates/ishtar/sheet_museum_find.html index 3acec990e..add8ce512 100644 --- a/archaeological_finds/templates/ishtar/sheet_museum_find.html +++ b/archaeological_finds/templates/ishtar/sheet_museum_find.html @@ -26,6 +26,7 @@ {% with non_modif_treatments_count=item.non_modif_treatments_count %} {% with associated_treatment_files_count=item.associated_treatment_files_count %} +{% with display_relations=item|safe_or:"right_relations.count|left_relations.count"|safe_and_not:"right_relations_not_available"|safe_and_not:"left_relations_not_available" %} {% with can_view_container=permission_view_own_container|or_:permission_view_container %} {% with display_warehouse_treatments=item.container|or_:item.container_ref|or_:item.upstream_treatment|or_:item.downstream_treatment|or_:non_modif_treatments_count|or_:associated_treatment_files_count %} {% with dating_list=item|m2m_listing:"datings" %} @@ -51,6 +52,15 @@ {% trans "Archaeological context" %} </a> </li> + {% if display_relations %} + <li class="nav-item"> + <a class="nav-link" id="{{window_id}}-relations-tab" + data-toggle="tab" href="#{{window_id}}-relations" role="tab" + aria-controls="{{window_id}}-relations" aria-selected="false"> + {% trans "Relations" %} + </a> + </li> + {% endif %} <li class="nav-item"> <a class="nav-link" id="{{window_id}}-datations-tab" data-toggle="tab" href="#{{window_id}}-datations" role="tab" @@ -270,6 +280,15 @@ </div> </div> + {% if display_relations %} + <div class="tab-pane fade" id="{{window_id}}-relations" + role="tabpanel" aria-labelledby="{{window_id}}-relations-tab"> + {% with relation_url="/show-find/" %} + {% include "ishtar/blocks/sheet_relations.html" %} + {% endwith %} + </div> + {% endif %} + <div class="tab-pane fade" id="{{window_id}}-datations" role="tabpanel" aria-labelledby="{{window_id}}-datations-tab"> <h3>{% trans "Periods / Datings" %}</h3> @@ -326,7 +345,7 @@ {% endif %} </div> -{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} +{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} <script type='text/javascript'> $( "#{{window_id}}-tabs" ).on( "tabsactivate", function( event, ui ) { diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index e290ce319..fced5457a 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -410,28 +410,9 @@ {% if display_relations %} <div class="tab-pane fade" id="{{window_id}}-relations" role="tabpanel" aria-labelledby="{{window_id}}-relations-tab"> - - {% if item.right_relations.count and not item.right_relations_not_available %} - <h3>{% trans "Relations"%}</h3> - {% for rel in item.right_relations.all %} - {% ifchanged rel.relation_type %} - {% if forloop.counter0 %}</div>{% endif %} - <h4>{{rel.relation_type}}</h4> - <div class="row">{% endifchanged %} - <div class="col-12"> - <a href="#" onclick="load_window('/show-operation/{{rel.right_record.pk|unlocalize}}/');" class="display_details"> - <i class="fa fa-info-circle" aria-hidden="true"></i> - </a> {{rel.right_record}} - </div> - {% if forloop.last %} - </div>{% endif %} - {% endfor %} - {% else %} - <div class="alert alert-info" role="alert"> - <i class="fa fa-info-circle" aria-hidden="true"></i> - {% trans "No relations" %} - </div> - {% endif %} + {% with relation_url="/show-operation/" %} + {% include "ishtar/blocks/sheet_relations.html" %} + {% endwith %} </div> {% endif %} diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html index 4116ee890..2ce9e7eaa 100644 --- a/archaeological_operations/templates/ishtar/sheet_site.html +++ b/archaeological_operations/templates/ishtar/sheet_site.html @@ -152,25 +152,9 @@ {% endif %} {% if display_relations %} -<h3>{% trans "Relations"%}</h3> -{% for rel in item.right_relations.all %} -{% ifchanged rel.relation_type %} -{% if forloop.counter0 %}</div>{% endif %} -<h4>{{rel.relation_type}}</h4> -<div class="row">{% endifchanged %} - <div class="col-12"> - <a href="#" onclick="load_window('/show-site/{{rel.right_record.pk|unlocalize}}/');" class="display_details"> - <i class="fa fa-info-circle" aria-hidden="true"></i> - </a> {{rel.right_record}} - </div> -{% if forloop.last %} -</div>{% endif %} -{% endfor %} -{% else %} -<div class="alert alert-info" role="alert"> - <i class="fa fa-info-circle" aria-hidden="true"></i> - {% trans "No relations" %} -</div> + {% with relation_url="/show-site/" %} + {% include "ishtar/blocks/sheet_relations.html" %} + {% endwith %} {% endif %} {% if not is_external and SHOW_GEO %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_relations.html b/ishtar_common/templates/ishtar/blocks/sheet_relations.html new file mode 100644 index 000000000..e18cb5532 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/sheet_relations.html @@ -0,0 +1,22 @@ +{% load i18n l10n %} + {% if display_relations %} + <h3>{% trans "Relations"%}</h3> + {% for rel in item.right_relations.all %} + {% ifchanged rel.relation_type %} + {% if forloop.counter0 %}</div>{% endif %} + <h4>{{rel.relation_type}}</h4> + <div class="row">{% endifchanged %} + <div class="col-12"> + <a href="#" onclick="load_window('{{relation_url}}{{rel.right_record.pk|unlocalize}}/');" class="display_details"> + <i class="fa fa-info-circle" aria-hidden="true"></i> + </a> {{rel.right_record}} + </div> + {% if forloop.last %} + </div>{% endif %} + {% endfor %} + {% else %} + <div class="alert alert-info" role="alert"> + <i class="fa fa-info-circle" aria-hidden="true"></i> + {% trans "No relations" %} + </div> + {% endif %} |
