summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-06 15:24:37 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:45:57 +0100
commit32b4271ea9e7540a7613429563fffde20e57690d (patch)
treeb99b9d116e9c0a64b18fbf3c24d32ed58db6238d /archaeological_operations
parent43e629c861fe5f73d4a0db94c9c49ac9592228c8 (diff)
downloadIshtar-32b4271ea9e7540a7613429563fffde20e57690d.tar.bz2
Ishtar-32b4271ea9e7540a7613429563fffde20e57690d.zip
🐛 more robust filters for sheets (refs #6109)
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html23
-rw-r--r--archaeological_operations/templates/ishtar/sheet_site.html6
2 files changed, 15 insertions, 14 deletions
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index a74c78ab1..86c425979 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -24,17 +24,18 @@
{% with permission_change_geo=permission_change_own_geovectordata|or_:permission_change_geovectordata %}
{% with display_data=item.data %}
-{% with display_relations=item|safe_or:"right_relations.count|left_relations.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 display_sites=item|safe_or:"archaeological_sites.count|grouped_parcels|administrative_act.count|archaeological_sites_list" %}
{% with perm_documents=permission_view_own_document|or_:permission_view_document %}
-{% with has_documents=item|safe_or:"documents.count|documents_list" %}
+{% with has_documents=item|safe_or:"documents.count|documents_list"|safe_and_not:"documents_not_available" %}
{% with display_documents=perm_documents|and_:has_documents %}
{% with perm_context_records=permission_view_own_contextrecord|or_:permission_view_contextrecord %}
-{% with has_context_records=item|safe_or:"context_record.count" %}
+{% with has_context_records=item|safe_or:"context_record.count"|safe_and_not:"context_record_not_available" %}
{% with display_context_records=perm_context_records|and_:has_context_records %}
{% with perm_find=permission_view_own_find|or_:permission_view_find %}
{% with has_finds=item|safe_or:"has_finds" %}
{% with display_finds=perm_find|and_:has_finds %}
+{% with has_image=item|safe_or:"images.count"|safe_and_not:"images_not_available" %}
{% if output != "ODT" and output != "PDF" %}
<ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist">
@@ -194,7 +195,6 @@
{% field_flex_2 "Code DRASSM" item.drassm_code %}
{% field_flex_2 "Old code" item.old_code %}
- {% with has_image=item.images.count %}
{% if not has_image %}
</div>
</div>
@@ -239,7 +239,6 @@
{% if has_image %}
</div> {# <div> #}
{% endif %}
- {% endwith %}
<hr class="clearfix">
{% field_flex_multiple_obj "Remains" item 'remains' %}
{% field_flex_multiple_obj "Chronological period" item 'periods' %}
@@ -368,7 +367,7 @@
<div class="tab-pane fade" id="{{window_id}}-sites"
role="tabpanel" aria-labelledby="{{window_id}}-sites-tab">
{% trans "Archaeological sites" as archaeologicalsites_label %}
- {% if item.archaeological_sites.count %}
+ {% if item.archaeological_sites.count and not item.archaeological_sites_not_available %}
{% dynamic_table_document archaeologicalsites_label 'sites' 'operations' item.pk '' output %}
{% elif item.archaeological_sites_list %}
<h3>{{archaeologicalsites_label}}</h3>
@@ -387,12 +386,12 @@
</table>
{% endif %}
- {% if item.parcels.count %}
+ {% if item.parcels.count and not item.parcels_not_available %}
{% trans "Associated parcels" as parcels_label %}
{% include "ishtar/blocks/window_tables/parcels.html" %}
{% endif %}
- {% if item.administrative_act.count %}
+ {% if item.administrative_act.count and not item.administrative_act_not_available %}
<h3>{% trans "Administrative acts" %}</h3>
{% table_administrativact "" item.administrative_act.all %}
{% endif %}
@@ -403,7 +402,7 @@
<div class="tab-pane fade" id="{{window_id}}-documents"
role="tabpanel" aria-labelledby="{{window_id}}-documents-tab">
{% trans "Document from this operation" as operation_docs %}
- {% if item.documents.count %}
+ {% if item.documents.count and not item.documents_not_available %}
{% dynamic_table_document operation_docs 'documents' 'operations' item.pk '' output %}
{% elif item.documents_list %}
<h3>{{operation_docs}}</h3>
@@ -416,7 +415,7 @@
<div class="tab-pane fade" id="{{window_id}}-relations"
role="tabpanel" aria-labelledby="{{window_id}}-relations-tab">
- {% if item.right_relations.count %}
+ {% 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 %}
@@ -443,8 +442,10 @@
{% if display_context_records %}
<div class="tab-pane fade" id="{{window_id}}-cr"
role="tabpanel" aria-labelledby="{{window_id}}-cr-tab">
+ {% if item.context_record.count %}
{% trans "Context records" as cr_lab %}
{% dynamic_table_document cr_lab 'context_records_for_ope' 'operation_id' item.pk 'TABLE_COLS_FOR_OPE' output %}
+ {% endif %}
{% if item.context_record_relations_q.count %}
{% trans "Context record relations" as cr_rels %}
@@ -653,6 +654,6 @@ $(document).ready( function () {
} );
{% endlocalize %}</script>
-{% 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 %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}
{% endblock %}
diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html
index c3154fdf5..f1c5b6ec8 100644
--- a/archaeological_operations/templates/ishtar/sheet_site.html
+++ b/archaeological_operations/templates/ishtar/sheet_site.html
@@ -96,18 +96,18 @@
{% include "ishtar/blocks/sheet_json.html" %}
{% trans "Operations" as operations %}
-{% if item.operations.count %}
+{% if item.operations.count and not item.operations_not_available %}
{% dynamic_table_document operations 'operations' 'archaeological_sites' item.pk '' output %}
{% endif %}
-{% if item.finds.count %}
+{% if item.finds.count and not item.finds_not_available %}
{% trans "Finds" as finds %}
{% dynamic_table_document finds 'finds' 'base_finds__context_record__archaeological_site' item.pk '' output %}
{% endif %}
{% trans "Documents" as docs %}
{% if permission_view_own_document or permission_view_document %}
-{% if item.documents.count %}
+{% if item.documents.count and not item.documents_not_available %}
{% dynamic_table_document docs 'documents' 'sites' item.pk '' output %}
{% endif %}
{% endif %}