summaryrefslogtreecommitdiff
path: root/archaeological_finds/templates/ishtar/sheet_treatment.html
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/templates/ishtar/sheet_treatment.html')
-rw-r--r--archaeological_finds/templates/ishtar/sheet_treatment.html19
1 files changed, 13 insertions, 6 deletions
diff --git a/archaeological_finds/templates/ishtar/sheet_treatment.html b/archaeological_finds/templates/ishtar/sheet_treatment.html
index 7fa2097f0..ae180dd5e 100644
--- a/archaeological_finds/templates/ishtar/sheet_treatment.html
+++ b/archaeological_finds/templates/ishtar/sheet_treatment.html
@@ -1,5 +1,5 @@
{% extends "ishtar/sheet.html" %}
-{% load i18n l10n window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %}
+{% load i18n l10n ishtar_helpers window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %}
{% block head_title %}<strong>{% trans "Treatment" %}</strong> - {{ item.cached_label|default:"" }}{% endblock %}
@@ -8,6 +8,12 @@
{% endblock %}
{% block content %}
+{# trick to set to null non existing variable #}
+{% with permission_view_document=permission_view_document %}
+{% with permission_view_own_document=permission_view_own_document %}
+{% with can_view_documents=permission_view_own_document|or_:permission_view_document %}
+{% with has_documents=item|safe_or:"documents.count|documents_list"|safe_and_not:"documents_not_available" %}
+{% with display_documents=can_view_documents|and_:has_documents %}
<ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist">
<li class="nav-item">
@@ -24,7 +30,7 @@
{% trans "Finds" %}
</a>
</li>
- {% if item.documents.count %}
+ {% if display_documents %}
<li class="nav-item">
<a class="nav-link" id="{{window_id}}-documents-tab"
data-toggle="tab" href="#{{window_id}}-documents" role="tab"
@@ -130,11 +136,12 @@
</div>
- {% if item.documents.count %}
+ {% if display_documents %}
<div class="tab-pane fade" id="{{window_id}}-documents"
role="tabpanel" aria-labelledby="{{window_id}}-documents-tab">
- {% trans "Associated documents" as treat_docs %}
- {% dynamic_table_document treat_docs 'documents' 'treatments' item.pk '' output %}
+ {% with permission_change_item=item|can_edit_item:request %}
+ {% include "ishtar/blocks/sheet_document_list.html" %}
+ {% endwith %}
</div>
{% endif %}
@@ -148,5 +155,5 @@
</div>
-{% endwith %}
+{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}
{% endblock %}