diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-13 13:30:02 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-13 15:48:10 +0100 |
commit | ce71f7f286819ee1399fef5f1819f9cc812149a6 (patch) | |
tree | 958d29dbd53c737182fadb61705daf50b0f6a81e /archaeological_finds | |
parent | 61cb345d6e39eac393c6fd8e4a8246b5221c69a9 (diff) | |
download | Ishtar-ce71f7f286819ee1399fef5f1819f9cc812149a6.tar.bz2 Ishtar-ce71f7f286819ee1399fef5f1819f9cc812149a6.zip |
✨ sheets: refactor document listing - add edit and unlink actions (refs #6221)
Diffstat (limited to 'archaeological_finds')
6 files changed, 27 insertions, 27 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 0c684d98a..69a8b899c 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -196,14 +196,13 @@ class AssociatedFindBasket: class Treatment( DashboardFormItem, AssociatedFindBasket, - ValueGetter, DocumentItem, BaseHistorizedItem, CompleteIdentifierItem, ImageModel, OwnPerms, - ShortMenuItem, - SheetItem, + ValueGetter, + MainItem, ): SLUG = "treatment" APP = "archaeological-finds" diff --git a/archaeological_finds/templates/ishtar/sheet_exhibition.html b/archaeological_finds/templates/ishtar/sheet_exhibition.html index 820391a9e..76cf7c495 100644 --- a/archaeological_finds/templates/ishtar/sheet_exhibition.html +++ b/archaeological_finds/templates/ishtar/sheet_exhibition.html @@ -78,8 +78,9 @@ {% if display_documents %} - {% trans "Associated documents" as associated_docs %} - {% dynamic_table_document associated_docs 'documents' 'treatment_files' item.pk '' output %} + {% with permission_change_item=item|can_edit_item:request %} + {% include "ishtar/blocks/sheet_document_list.html" %} + {% endwith %} {% endif %} {% if item.administrative_act.count %} diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index d38b0060f..9b439825c 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -280,13 +280,9 @@ {% if display_documents %} <div class="tab-pane fade" id="{{window_id}}-documents" role="tabpanel" aria-labelledby="{{window_id}}-documents-tab"> - {% trans "Associated documents" as finds_docs %} - {% if item.documents.count %} - {% dynamic_table_document finds_docs 'documents' 'finds' item.pk '' output %} - {% elif item.documents_list %} - <h3>{{finds_docs}}</h3> - {% include "ishtar/blocks/api_document_list.html" %} - {% endif %} + {% with permission_change_item=item|can_edit_item:request %} + {% include "ishtar/blocks/sheet_document_list.html" %} + {% endwith %} </div> {% endif %} diff --git a/archaeological_finds/templates/ishtar/sheet_museum_find.html b/archaeological_finds/templates/ishtar/sheet_museum_find.html index 2f313f0a1..fb5e2adca 100644 --- a/archaeological_finds/templates/ishtar/sheet_museum_find.html +++ b/archaeological_finds/templates/ishtar/sheet_museum_find.html @@ -304,13 +304,9 @@ {% if display_documents %} <div class="tab-pane fade" id="{{window_id}}-documents" role="tabpanel" aria-labelledby="{{window_id}}-documents-tab"> - {% trans "Associated documents" as finds_docs %} - {% if item.documents.count %} - {% dynamic_table_document finds_docs 'documents' 'finds' item.pk '' output %} - {% elif item.documents_list %} - <h3>{{finds_docs}}</h3> - {% include "ishtar/blocks/api_document_list.html" %} - {% endif %} + {% with permission_change_item=item|can_edit_item:request %} + {% include "ishtar/blocks/sheet_document_list.html" %} + {% endwith %} </div> {% endif %} 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 %} diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html index 6cca72570..c6f5d3056 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html +++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html @@ -79,8 +79,9 @@ {% endif %} {% if display_documents %} -{% trans "Associated documents" as associated_docs %} -{% dynamic_table_document associated_docs 'documents' 'treatment_files' item.pk '' output %} + {% with permission_change_item=item|can_edit_item:request %} + {% include "ishtar/blocks/sheet_document_list.html" %} + {% endwith %} {% endif %} {% if item.administrative_act.count %} |