diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-06 17:14:22 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-06 17:21:20 +0100 |
commit | 6bfcffe23290c79c7d72e0aec45bd9ed86d52c14 (patch) | |
tree | 9ca5af2de85f63b530dabfdbf1581fcda1a49f74 /archaeological_finds | |
parent | b40535a62e864993de75f784bc4d583b68eb29d6 (diff) | |
download | Ishtar-6bfcffe23290c79c7d72e0aec45bd9ed86d52c14.tar.bz2 Ishtar-6bfcffe23290c79c7d72e0aec45bd9ed86d52c14.zip |
Sheet Treatment file: add associated image and document list (refs #4275)
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models_treatments.py | 3 | ||||
-rw-r--r-- | archaeological_finds/templates/ishtar/sheet_treatmentfile.html | 25 |
2 files changed, 17 insertions, 11 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 2ee23c1c6..5e355cfcd 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -46,6 +46,7 @@ from ishtar_common.models import ( ShortMenuItem, DashboardFormItem, document_attached_changed, + MainItem, HistoryModel, SearchAltName, SearchVectorConfig, @@ -1017,7 +1018,7 @@ class TreatmentFile( CompleteIdentifierItem, OwnPerms, ValueGetter, - ShortMenuItem, + MainItem, ): SLUG = "treatmentfile" APP = "archaeological-finds" diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html index 0c036978f..eacf853ca 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html +++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html @@ -1,5 +1,5 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} +{% load i18n ishtar_helpers window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} {% block head_title %}<strong>{% trans "Treatment request" %}</strong> - {{ item.name|default:"" }}{% endblock %} @@ -8,10 +8,13 @@ {% endblock %} {% block content %} +{% with perm_documents=permission_view_own_document|or_:permission_view_document %} +{% with has_documents=item|safe_or:"documents.count|documents_list" %} +{% with display_documents=perm_documents|and_:has_documents %} -<div class="row"> - <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12"> - <div class="card"> +<div class="clearfix"> + <div class="card float-left col-12 col-md-6 col-lg-4"> + {% include "ishtar/blocks/window_image.html" %} <div class="card-body"> <div class="card-text"> <p class="window-refs">{{ item.name|default:"" }}</p> @@ -28,10 +31,12 @@ </div> </div> </div> - </div> +{% with has_image=item.images.count %} +{% if not has_image %} </div> - +{% endif %} <div class="row"> + {% endwith %} {% field_flex "Type" item.type %} {% field_flex_detail "Responsible" item.in_charge %} {% field_flex_detail "Associated basket" item.associated_basket %} @@ -41,6 +46,7 @@ {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} {% include "ishtar/blocks/sheet_json.html" %} </div> +</div> {% if item.exhibition_name or item.exhibition_start_date or item.exhibition_end_date %} <h3>{% trans "Exhibition" %}</h3> @@ -72,16 +78,15 @@ {% dynamic_table_document treatments 'treatments' 'file' item.pk '' output '' 'treatment' %} {% endif %} -{% comment %} -{% if item.source.count %} +{% if display_documents %} {% trans "Associated documents" as associated_docs %} -{% dynamic_table_document associated_docs 'treatmentfiles_docs' 'treatment_file' item.pk '' output %} +{% dynamic_table_document associated_docs 'documents' 'treatment_files' item.pk '' output %} {% endif %} -{% endcomment %} {% if item.administrative_act.count %} {% trans "Administrative acts" as admact_lbl %} {% table_administrativact admact_lbl item.administrative_act.all %} {% endif %} +{% endwith %}{% endwith %}{% endwith %} {% endblock %} |