From ddb40987f608136dd492721c69d30c2c54d247e4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 8 Jul 2019 12:12:45 +0200 Subject: Contextt record sheet: refactor display --- .../templates/ishtar/sheet_contextrecord.html | 437 +++++++++++++-------- .../ishtar/blocks/sheet_relation_image.html | 33 ++ 2 files changed, 309 insertions(+), 161 deletions(-) create mode 100644 ishtar_common/templates/ishtar/blocks/sheet_relation_image.html diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 0e3138583..284ea7f32 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -1,5 +1,5 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_field window_header window_tables window_field %} +{% load i18n ishtar_helpers window_field window_header window_tables window_field %} {% block head_title %}{% trans "Context Record" %} - {{item.full_label}}{% endblock %} @@ -9,189 +9,304 @@ {% block content %} -
-
- {% include "ishtar/blocks/window_image.html" %} -
-

-

{{ item.parcel.short_label }}

-

{{ item.label|default:"" }}

- {% include "ishtar/blocks/sheet_external_id.html" %} -

-
-
+{% 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 display_documents=can_view_documents|and_:item.documents.count %} +{% with display_relations=item.right_relations.count|or_:item.left_relations.count %} +{% with has_image=item.images.count %} +{% with display_interpretation=item.activity|or_:item.identification|or_:item.interpretation|or_:item.filling %} +{% with display_datations=item.taq|or_:item.taq_estimated|or_:item.tpq|or_:item.tpq_estimated %} +{% with can_view_finds=permission_view_own_find|or_:permission_view_find %} +{% with display_finds=item.base_finds.count|and_:can_view_finds %} +{% with display_data=item.data %} -
- {% field_flex_2 "Complete ID" item.full_label %} - {% field_flex_2 "Type" item.unit %} - {% with has_image=item.images.count %} +{% if output != "ODT" and output != "PDF"%} + +{% endif %} - {% if not has_image %} -
-
-
+
+ +
+ {% if has_image %} +
+
+ {% include "ishtar/blocks/window_image.html" %} +
+

+

{{ item.parcel.short_label }}

+

{{ item.label|default:"" }}

+ {% include "ishtar/blocks/sheet_external_id.html" %} +

+
+
+
{% endif %} +
+ {% field_flex_2 "Complete ID" item.full_label %} + {% field_flex_2 "Type" item.unit %} +
+

{% trans "Description"%}

+
+ {% field_flex "Excavation technic" item.excavation_technic '' '' has_image %} + {% field_flex_multiple_obj "Chronology" item 'datings' has_image %} + {% field_flex "Town" item.town.label_with_areas '' '' has_image %} + {% field_flex_multiple_obj "Documentation" item 'documentations' has_image %} + {% field_flex "Opening date" item.opening_date '' '' has_image %} + {% field_flex "Closing date" item.closing_date '' '' has_image %} + {% field_flex_full "Comment on datings" item.datings_comment "
" "
" has_image %} + {% field_flex_full "Description" item.description "
" "
" has_image %} + {% field_flex_full "Comment" item.comment "
" "
" has_image %} + {% field_flex "Length (m)" item.lenght '' '' has_image %} + {% field_flex "Width (m)" item.width '' '' has_image %} + {% field_flex "Diameter (m)" item.diameter '' '' has_image %} + {% field_flex "Depth (m)" item.depth '' '' has_image %} + {% field_flex "Thickness (m)" item.thickness '' '' has_image %} + {% field_flex "Depth of appearance (m)" item.depth_of_appearance '' '' has_image %} +
- {% field_flex "Excavation technic" item.excavation_technic '' '' has_image %} - {% field_flex_multiple_obj "Chronology" item 'datings' has_image %} - {% field_flex "Town" item.town.label_with_areas '' '' has_image %} - {% field_flex_multiple_obj "Documentation" item 'documentations' has_image %} - {% field_flex "Opening date" item.opening_date '' '' has_image %} - {% field_flex "Closing date" item.closing_date '' '' has_image %} - {% field_flex_full "Comment on datings" item.datings_comment "
" "
" has_image %} +

{% trans "Localisation"%}

+
+ {% with geo_item=item %} + {% include "ishtar/blocks/sheet_simple_map.html"%} +
+ {% field_flex_multiple_full "Towns" item.operation.towns %} + {% include "ishtar/blocks/sheet_coordinates.html"%} +
+ {% endwith %} +
+ +

{% trans "Sheet" %}

+
+ {% include "ishtar/blocks/sheet_creation_section.html" %} +
+
+ {% if display_interpretation %} +
+

{% trans "Interpretation"%}

+
+ {% field_flex_multiple "Documentation" item.documentations %} + {% field_flex "Activity" item.activity %} + {% field_flex "Identification" item.identification %} + {% field_flex_full "Filling" item.filling "
" "
" %} + {% field_flex_full "Interpretation" item.interpretation "
" "
" %} +
+ {% endif %} - {% if item.diameter or item.depth_of_appearance or item.documentations.count or item.description or item.lenght or item.width or item.depth or item.thickness or item.comment %} -

{% trans "Description"%}

-
- {% field_flex_full "Description" item.description "
" "
" has_image %} - {% field_flex_full "Comment" item.comment "
" "
" has_image %} - {% field_flex "Length (m)" item.lenght '' '' has_image %} - {% field_flex "Width (m)" item.width '' '' has_image %} - {% field_flex "Diameter (m)" item.diameter '' '' has_image %} - {% field_flex "Depth (m)" item.depth '' '' has_image %} - {% field_flex "Thickness (m)" item.thickness '' '' has_image %} - {% field_flex "Depth of appearance (m)" item.depth_of_appearance '' '' has_image %} + {% if display_datations %} +
+

{% trans "Datations"%}

+
+ {% field_flex "TAQ" item.taq %} + {% field_flex "Estimated TAQ" item.taq_estimated %} + {% field_flex "TPQ" item.tpq %} + {% field_flex "Estimated TPQ" item.tpq_estimated %} +
{% endif %} -{% if has_image %} -
-{% endif %} -{% endwith %} - -{% if item.activity or item.identification or item.interpretation %} -

{% trans "Interpretation"%}

-
- {% field_flex_multiple "Documentation" item.documentations %} - {% field_flex "Activity" item.activity %} - {% field_flex "Identification" item.identification %} - {% field_flex_full "Filling" item.filling "
" "
" %} - {% field_flex_full "Interpretation" item.interpretation "
" "
" %} -
-{% endif %} +
-{% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %} -

{% trans "Datations"%}

-
- {% field_flex "TAQ" item.taq %} - {% field_flex "Estimated TAQ" item.taq_estimated %} - {% field_flex "TPQ" item.tpq %} - {% field_flex "Estimated TPQ" item.tpq_estimated %} -
-{% endif %} + {% if item.operation %} +

{% trans "Operation summary"%}

+ {% if not item.operation.code_patriarche %} + + {% endif %} +
+ {% field_flex_detail_full "Operation" item.operation %} + {% field_flex "Year" item.operation.year %} + {% trans "Numerical reference" as num_ref_label %} + {% field_flex num_ref_label item.operation.operation_code %} + {% field_flex "Patriarche OA code" item.operation.code_patriarche %} + {% field_flex_detail "Head scientist" item.operation.scientist %} -

{% trans "Sheet"%}

-
- {% include "ishtar/blocks/sheet_creation_section.html" %} -
+
+
{% trans "State" %}
+
{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}
+
-{% include "ishtar/blocks/sheet_json.html" %} + {% if not item.operation.is_active %} +
+
{%trans "Closing date"%}
+
+ {{ item.operation.closing.date }} {%trans "by" %} {{ item.operation.closing.user }} +
+
+ {% endif %} + {% field_flex "Type" item.operation.operation_type %} + {% field_flex_multiple "Remains" item.operation.remains %} + {% field_flex_multiple "Periods" item.operation.periods %} + {% field_flex_full "Comment" item.operation.comment "
" "
" %} +
-{% trans "Context record relations" as cr_rels %} -{% if item.right_relations.count %} -{% dynamic_table_document cr_rels 'context_records_relations' 'left_record_id' item.pk '' output %} + {% else %} + + {% endif %} -{% if item.relation_image %} -
- {% if output != "ODT" %}{% endif %} - - {% if output != "ODT" %}{% endif %} -
-{% endif %} + {% if item.archaeological_site %} +

{% trans SITE_LABEL %}

+
+ {% field_flex_detail SITE_LABEL item.archaeological_site %} + {% field_flex_full "Towns" item.archaeological_site.towns_codes|join:" ; " %} +
+ {% endif %} +
-{% if DOT_GENERATION %} -

- - {% if item.relation_image %} - {% trans "Re-generate image" %} - {% else %} - {% trans "Generate image" %} + {% if display_finds %} +

+ + {% trans "Finds" as finds %} + {% if item.base_finds.count %} + {% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record' item.pk 'TABLE_COLS_FOR_OPE' output %} {% endif %} - -

-{% endif %} -
-{% endif %} -{% if item.operation %} -

{% trans "Operation summary"%}

-{% if not item.operation.code_patriarche %} - -{% endif %} -
- {% field_flex "Year" item.operation.year %} - {% trans "Numerical reference" as num_ref_label %} - {% field_flex num_ref_label item.operation.operation_code %} - {% field_flex "Patriarche OA code" item.operation.code_patriarche %} - {% field_flex_detail "Head scientist" item.operation.scientist %} - -
-
{% trans "State" %}
-
{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}
-
- - {% if not item.operation.is_active %} -
-
{%trans "Closing date"%}
-
- {{ item.operation.closing.date }} {%trans "by" %} {{ item.operation.closing.user }} -
-
+ {% trans "Documents from associated finds" as finds_docs %} + {% if permission_view_own_document or permission_view_document %} + {% if item.find_docs_q.count %} + {% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record' item.pk '' output %} + {% endif %} + {% endif %} +
{% endif %} - {% field_flex "Type" item.operation.operation_type %} - {% field_flex_multiple "Remains" item.operation.remains %} - {% field_flex_multiple "Periods" item.operation.periods %} - {% field_flex_full "Comment" item.operation.comment "
" "
" %} -
-

{% trans "Localisation"%}

-
- {% with geo_item=item %} - {% include "ishtar/blocks/sheet_simple_map.html"%} -
- {% field_flex_multiple_full "Towns" item.operation.towns %} - {% field_flex_detail_full "Operation" item.operation %} - {% include "ishtar/blocks/sheet_coordinates.html"%} -
- {% endwith %} -
+ {% if display_relations %} +
-{% else %} - -{% endif %} + {% trans "Context record relations" as cr_rels %} + {% dynamic_table_document cr_rels 'context_records_relations' 'left_record_id' item.pk '' output %} -{% if item.archaeological_site %} -

{% trans SITE_LABEL %}

-
- {% field_flex_detail SITE_LABEL item.archaeological_site %} - {% field_flex_full "Towns" item.archaeological_site.towns_codes|join:" ; " %} -
-{% endif %} + {% if item.relation_image or DOT_GENERATION %} + {% with gen_url='generate-relation-image-contextrecord' %} -{% trans "Document from this context record" as cr_docs %} -{% if permission_view_own_document or permission_view_document %} -{% if item.documents.count %} -{% dynamic_table_document cr_docs 'documents' 'context_records' item.pk '' output %} -{% endif %} -{% endif %} +

{% trans "Diagram of statigraphic relations - full" %}

+ {% with relation_type="" %} + {% with relation_image=item.relation_image %} + {% with relation_png=item.relation_bitmap_image %} + {% with relation_dot=item.relation_dot %} + {% include "ishtar/blocks/sheet_relation_image.html" %} + {% endwith %}{% endwith %}{% endwith %}{% endwith %} -{% trans "Finds" as finds %} -{% if item.base_finds.count %} -{% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record' item.pk 'TABLE_COLS_FOR_OPE' output %} -{% endif %} +

{% trans "Diagram of statigraphic relations - bellow" %}

+ {% with relation_type="bellow" %} + {% with relation_image=item.relation_image_bellow %} + {% with relation_png=item.relation_bitmap_image_bellow %} + {% with relation_dot=item.relation_dot_bellow %} + {% include "ishtar/blocks/sheet_relation_image.html" %} + {% endwith %}{% endwith %}{% endwith %}{% endwith %} -{% trans "Documents from associated finds" as finds_docs %} -{% if permission_view_own_document or permission_view_document %} -{% if item.find_docs_q.count %} -{% dynamic_table_document finds_docs 'documents' 'finds__base_finds__context_record' item.pk '' output %} -{% endif %} -{% endif %} +

{% trans "Diagram of statigraphic relations - above" %}

+ {% with relation_type="above" %} + {% with relation_image=item.relation_image_above %} + {% with relation_png=item.relation_bitmap_image_above %} + {% with relation_dot=item.relation_dot_above %} + {% include "ishtar/blocks/sheet_relation_image.html" %} + {% endwith %}{% endwith %}{% endwith %}{% endwith %} + + {% endwith %} + {% endif %} +
+ {% endif %} + + {% if display_documents %} +
+ {% trans "Document from this context record" as cr_docs %} + {% if permission_view_own_document or permission_view_document %} + {% if item.documents.count %} + {% dynamic_table_document cr_docs 'documents' 'context_records' item.pk '' output %} + {% endif %} + {% endif %} +
+ {% endif %} + + {% if display_data %} +
+ {% include "ishtar/blocks/sheet_json.html" %} +
+ {% endif %} +
+ +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endblock %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_relation_image.html b/ishtar_common/templates/ishtar/blocks/sheet_relation_image.html new file mode 100644 index 000000000..971fcda06 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/sheet_relation_image.html @@ -0,0 +1,33 @@ +{% load i18n %}{% if relation_image %} +
+ {% if output != "ODT" %}{% endif %} + + {% if output != "ODT" %}{% endif %} +
+{% endif %} + +{% if DOT_GENERATION and output != "ODT" and output != "PDF" %} +
+
+
+ {% if relation_image %} + SVG + {% endif %} + {% if relation_png %} + PNG + {% endif %} + {% if relation_dot %} + DOT + {% endif %} + + {% if relation_image %} + {% trans "Re-generate image" %} + {% else %} + {% trans "Generate image" %} + {% endif %} + +
+
+
+{% endif %} -- cgit v1.2.3