From 5f8d692a804be6d4e0689a3c4c8ba71b0ce82f2b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 2 Oct 2018 01:23:43 +0200 Subject: Sheet refactoring with images --- .../templates/ishtar/sheet_contextrecord.html | 84 ++++++++------ .../templates/ishtar/sheet_basefind.html | 87 ++++++++++++++ .../templates/ishtar/sheet_find.html | 118 ++++--------------- .../templates/ishtar/sheet_operation.html | 127 ++++++++++++--------- .../ishtar/blocks/window_field_flex_detail.html | 2 +- .../ishtar/blocks/window_field_flex_multiple.html | 2 +- ishtar_common/templatetags/window_field.py | 36 ++++-- scss/custom.scss | 6 +- 8 files changed, 258 insertions(+), 204 deletions(-) create mode 100644 archaeological_finds/templates/ishtar/sheet_basefind.html diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index c605addb9..2ad74b7d2 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -9,49 +9,56 @@ {% block content %} -
-
-
- {% include "ishtar/blocks/window_image.html" %} -
-

-

{{ item.parcel.short_label }}

-

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

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

-
+
+
+ {% include "ishtar/blocks/window_image.html" %} +
+

+

{{ item.parcel.short_label }}

+

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

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

-
-
- {% field_flex "Complete ID" item.full_label %} - {% include "ishtar/blocks/sheet_creation_section.html" %} - {% field_flex "Type" item.unit %} - {% field_flex "Excavation technic" item.excavation_technic %} - {% field_flex_multiple "Chronology" item.datings %} - {% field_flex "Town" item.town.label_with_areas %} - {% field_flex_multiple "Documentation" item.documentations %} - {% field_flex "Opening date" item.opening_date %} - {% field_flex "Closing date" item.closing_date %} - {% field_flex_full "Comment on datings" item.datings_comment "
" "
" %} +
+ {% field_flex_2 "Complete ID" item.full_label %} + {% field_flex_2 "Type" item.unit %} + {% with has_image=item.images.count %} + + {% if not has_image %} +
+
+ {% endif %} -{% include "ishtar/blocks/sheet_json.html" %} + {% field_flex "Excavation technic" item.excavation_technic '' '' has_image %} + {% field_flex_multiple "Chronology" item.datings has_image %} + {% field_flex "Town" item.town.label_with_areas '' '' has_image %} + {% field_flex_multiple "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 %} +
-{% 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 "
" "
" %} - {% field_flex_full "Comment" item.comment "
" "
" %} - {% field_flex "Length (m)" item.lenght %} - {% field_flex "Width (m)" item.width %} - {% field_flex "Diameter (m)" item.diameter %} - {% field_flex "Depth (m)" item.depth %} - {% field_flex "Thickness (m)" item.thickness %} - {% field_flex "Depth of appearance (m)" item.depth_of_appearance %} + {% 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 %} +
+ {% endif %} + +{% if has_image %}
{% endif %} +{% endwith %} {% if item.activity or item.identification or item.interpretation %}

{% trans "Interpretation"%}

@@ -74,6 +81,13 @@
{% endif %} +

{% trans "Sheet"%}

+
+ {% include "ishtar/blocks/sheet_creation_section.html" %} +
+ +{% include "ishtar/blocks/sheet_json.html" %} + {% 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 %} diff --git a/archaeological_finds/templates/ishtar/sheet_basefind.html b/archaeological_finds/templates/ishtar/sheet_basefind.html new file mode 100644 index 000000000..c20ca66ee --- /dev/null +++ b/archaeological_finds/templates/ishtar/sheet_basefind.html @@ -0,0 +1,87 @@ +{% load i18n window_field from_dict link_to_window window_tables window_header humanize %} +

{{base_find.complete_id }}

+

{{base_find.short_id }}

+ {% if base_find.external_id %} +

+ + + {{base_find.external_id|default:''}} + +

{% endif %} + +
+ {% field_flex_detail "Operation" base_find.context_record.operation first %} + {% field_flex_detail "Archaeological site" base_find.context_record.archaeological_site first %} + {% field_flex_detail "Context record" base_find.context_record first %} + {% field_flex "Town" base_find.context_record.town.label_with_areas '' '' first %} + {% field_flex "Parcel" base_find.context_record.parcel '' '' first %} + + {# START discovery dates #} + {% if not base_find.discovery_date_taq %} + {% trans "Discovery date" as discovery_date_label %} + {% field_flex discovery_date_label base_find.discovery_date '' '' first %} + {% elif base_find.discovery_date.year == base_find.discovery_date_taq.year and base_find.discovery_date_taq|date:"d-m" == "31-12" and base_find.discovery_date|date:"d-m" == "01-01" %} + {% trans "Discovery year" as discovery_year_label %} + {% field_flex discovery_year_label base_find.discovery_date.year '' '' first %} + {% else %} + {% trans "Discovery date (TPQ)" as discovery_tpq_label %} + {% field_flex discovery_tpq_label base_find.discovery_date '' '' first %} + {% trans "Discovery date (TAQ)" as discovery_taq_label %} + {% field_flex discovery_taq_label base_find.discovery_date_taq '' '' first %} + {% endif %} + {# END discovery dates #} + + {% field_flex "Excavation ID" base_find.excavation_id '' '' first %} + {% field_flex "Batch/object" base_find.batch '' '' first %} + {% if base_find.history_object and base_find.history_object.IS_ISOLATED_DICT %} + {% field_flex "Batch/object" base_find.batch|from_dict:base_find.history_object.IS_ISOLATED_DICT '' '' first %} + {% endif %} + + {% field_flex "Special interest" base_find.special_interest '' '' first %} + {% field_flex_full "Description" base_find.description "
" "
" first %} + {% field_flex_full "Comment" base_find.comment "
" "
" first %} +
+ + {% if base_find.x or base_find.y or base_find.topographic_localisation %} +

{% trans "Coordinates"%}

+
+ {% field_flex "Point of topographic reference" base_find.topographic_localisation %} +
+
{% trans "Coordinates" %}
+
+ {% trans "X:"%} {{base_find.x|default_if_none:"-"}} + {% if base_find.estimated_error_x %} ({% trans "error:" %} {{base_find.estimated_error_x}}){% endif %}, + {% trans "Y:"%} {{base_find.y|default_if_none:"-"}}, + {% if base_find.estimated_error_y %} ({% trans "error:" %} {{base_find.estimated_error_y}}){% endif %}, + {% trans "Z:"%} {{base_find.z|default_if_none:"-"}} + {% if base_find.estimated_error_z %} ({% trans "error:" %} {{base_find.estimated_error_z}}){% endif %} + {% if base_find.spatial_reference_system %} + – {{base_find.spatial_reference_system.label}}{% if base_find.spatial_reference_system.srid %} - + {% trans "SRID"%} {{base_find.spatial_reference_system.srid}}{% endif %} + {% endif %} +
+
+
+ {% endif %} +

{% trans "Sheet"%}

+
+ {% with item.history_creation_date|date:"SHORT_DATETIME_FORMAT" as creation_date %} + {% with item.history_creator.ishtaruser.full_label|add:"
"|add:creation_date|add:"" as creator %} + {% field_flex "Created by" creator|safe '' '' first %} + {% endwith %}{% endwith %} + {% if item.history_creation_date != item.last_edition_date %} + {% with item.last_edition_date|date:"SHORT_DATETIME_FORMAT" as edition_date %} + {% with item.history_modifier.ishtaruser.full_label|add:"
"|add:edition_date|add:"" as modifier %} + {% trans "Last modified by" as lastmodifiedby_label %} + {% field_flex lastmodifiedby_label modifier|safe '' '' first %} + {% endwith %}{% endwith %} + {% endif %} +
+ +{% if first %} +
+
+
+{% endif %} + +{% if forloop.counter0 %}
{% endif %} diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index f36dd6afe..55c02d8c7 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -9,114 +9,36 @@ {% block content %} -
-
-
- {% include "ishtar/blocks/window_image.html" %} -
-

-

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

-

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

-

{% for base_find in item.base_finds.all %}{% if forloop.counter0 %} – {% endif %}{{base_find.complete_id}}{% endfor %}

-

{% for base_find in item.base_finds.all %}{% if forloop.counter0 %} – {% endif %}{{base_find.short_id}}{% endfor %}

-

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

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

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

{% trans "Associated base finds"%}

- -
- {% for base_find in item.base_finds.all %} -

{{base_find.complete_id }}

-

{{base_find.short_id }}

- {% if base_find.external_id %} -

- - - {{base_find.external_id|default:''}} - -

{% endif %} - -
- {% with item.history_creation_date|date:"SHORT_DATETIME_FORMAT" as creation_date %} - {% with item.history_creator.ishtaruser.full_label|add:"
"|add:creation_date|add:"" as creator %} - {% field_flex "Created by" creator|safe %} - {% endwith %}{% endwith %} - {% if item.history_creation_date != item.last_edition_date %} - {% with item.last_edition_date|date:"SHORT_DATETIME_FORMAT" as edition_date %} - {% with item.history_modifier.ishtaruser.full_label|add:"
"|add:edition_date|add:"" as modifier %} - {% trans "Last modified by" as lastmodifiedby_label %} - {% field_flex lastmodifiedby_label modifier|safe %} - {% endwith %}{% endwith %} - {% endif %} - {% field_flex "Excavation ID" base_find.excavation_id %} - {% field_flex "Batch/object" base_find.batch %} - {% if base_find.history_object and base_find.history_object.IS_ISOLATED_DICT %} - {% field_flex "Batch/object" base_find.batch|from_dict:base_find.history_object.IS_ISOLATED_DICT %} - {% endif %} +
+
+ {% include "ishtar/blocks/window_image.html" %} +
+

+

+
+
- {# START discovery dates #} - {% if not base_find.discovery_date_taq %} - {% trans "Discovery date" as discovery_date_label %} - {% field_flex discovery_date_label base_find.discovery_date %} - {% elif base_find.discovery_date.year == base_find.discovery_date_taq.year and base_find.discovery_date_taq|date:"d-m" == "31-12" and base_find.discovery_date|date:"d-m" == "01-01" %} - {% trans "Discovery year" as discovery_year_label %} - {% field_flex discovery_year_label base_find.discovery_date.year %} - {% else %} - {% trans "Discovery date (TPQ)" as discovery_tpq_label %} - {% field_flex discovery_tpq_label base_find.discovery_date %} - {% trans "Discovery date (TAQ)" as discovery_taq_label %} - {% field_flex discovery_taq_label base_find.discovery_date_taq %} - {% endif %} - {# END discovery dates #} +

{% trans "Associated base finds"%}

- {% field_flex "Special interest" base_find.special_interest %} - {% field_flex_detail "Context record" base_find.context_record %} - {% field_flex "Town" base_find.context_record.town.label_with_areas %} - {% field_flex "Parcel" base_find.context_record.parcel %} - {% field_flex_detail "Operation" base_find.context_record.operation %} - {% field_flex_detail "Archaeological site" base_find.context_record.archaeological_site %} - {% field_flex_full "Description" base_find.description "
" "
" %} - {% field_flex_full "Comment" base_find.comment "
" "
" %} +
+ {% for base_find in item.base_finds.all %} + {% with first=forloop.first|add:item.images.count %} + {% include "ishtar/sheet_basefind.html" %} + {% endwith %} + {% endfor %}
- {% if base_find.x or base_find.y or base_find.topographic_localisation %} -

{% trans "Coordinates"%}

-
- {% field_flex "Point of topographic reference" base_find.topographic_localisation %} -
-
{% trans "Coordinates" %}
-
- {% trans "X:"%} {{base_find.x|default_if_none:"-"}} - {% if base_find.estimated_error_x %} ({% trans "error:" %} {{base_find.estimated_error_x}}){% endif %}, - {% trans "Y:"%} {{base_find.y|default_if_none:"-"}}, - {% if base_find.estimated_error_y %} ({% trans "error:" %} {{base_find.estimated_error_y}}){% endif %}, - {% trans "Z:"%} {{base_find.z|default_if_none:"-"}} - {% if base_find.estimated_error_z %} ({% trans "error:" %} {{base_find.estimated_error_z}}){% endif %} - {% if base_find.spatial_reference_system %} - – {{base_find.spatial_reference_system.label}}{% if base_find.spatial_reference_system.srid %} - - {% trans "SRID"%} {{base_find.spatial_reference_system.srid}}{% endif %} - {% endif %} -
-
-
- {% endif %} +

{% trans "Identification" %}

+
+ {% include "ishtar/blocks/sheet_external_id.html" %}
-{% if forloop.counter0 %}
{% endif %} -{% endfor %} - -

{% trans "Identification" %}

{% field_flex "Denomination" item.denomination %} @@ -127,7 +49,6 @@ {% field_flex "Seal number" item.seal_number %} {% trans "Administrative index" as admin_index_label %} {% field_flex admin_index_label item.administrative_index %} - {% include "ishtar/blocks/sheet_creation_section.html" %} {% field_flex_full "Mark" item.mark "
" "
" %}
@@ -176,6 +97,7 @@ {% field_flex checked_label item.checked|from_dict:item.history_object.CHECK_DICT %} {% endif%} {% field_flex "Check date" item.check_date %} + {% include "ishtar/blocks/sheet_creation_section.html" %}
{% if item.integrities.count or item.remarkabilities.count or item.conservatory_state or item.conservatory_comment or item.alterations.count or item.alteration_causes.count or item.preservation_to_considers.count or item.appraisal_date or item.treatment_emergency or item.insurance_value or item.estimated_value %} diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 91c1501ec..733b0b39a 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -9,9 +9,10 @@ {% block content %} -
-
-
+

{% trans "General"%}

+ +
+
{% include "ishtar/blocks/window_image.html" %}
@@ -25,66 +26,75 @@

-

{{item.common_name|default:''}}

-

{{item.address|default:''}}

+

{{item.common_name|default:''}}

+

{{item.address|default:''}}

-
-
- -

{% trans "General"%}

-
- {% field_flex "Old code" item.old_code %} - {% include "ishtar/blocks/sheet_creation_section.html" %} - {% trans "Begining date" as begining_date_label %} - {% field_flex begining_date_label item.start_date|date:"DATE_FORMAT" %} - {% field_flex "Excavation end date" item.excavation_end_date|date:"DATE_FORMAT"|default:"-" %} - {% field_flex_detail "Head scientist" item.scientist %} - {% field_flex_detail "In charge" item.in_charge %} - {% field_flex_multiple "Collaborators" item.collaborators %} - {% field_flex_detail "Operator" item.operator %} -
-
{%trans "State"%}
-
- {% if item.is_active %}{%trans "Active file"%} - {% else %}{%trans "Closed operation"%}{% endif %} -
-
- {% if item.closing.date %} -
-
{%trans "Closing date"%}
-
- {{ item.closing.date }} {%trans "by" %} {{ item.closing.user }} -
+
+ {% field_flex_2 "Old code" item.old_code %} + {% trans "Begining date" as begining_date_label %} + {% field_flex_2 begining_date_label item.start_date|date:"DATE_FORMAT" %} + {% field_flex_2 "Excavation end date" item.excavation_end_date|date:"DATE_FORMAT"|default:"-" %} + {% with has_image=item.images.count %} + {% if not has_image %}
- {% endif %} - {% field_flex "Type" item.operation_type %} - {% if item.surface %} -
-
{%trans "Surface"%}
-
- {{ item.surface }} m2 ({{ item.surface_ha }} ha) -
-
- {% endif %} - {% if item.cost %} -
-
{%trans "Cost" %}
-
- {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%} -
+
+
+ {% endif %} + + {% field_flex_detail "Head scientist" item.scientist has_image %} + {% field_flex_detail "In charge" item.in_charge has_image %} + {% field_flex_multiple "Collaborators" item.collaborators has_image %} + {% field_flex_detail "Operator" item.operator has_image %} +
+
{%trans "State"%}
+
+ {% if item.is_active %}{%trans "Active file"%} + {% else %}{%trans "Closed operation"%}{% endif %} +
+
+ {% if item.closing.date %} +
+
{%trans "Closing date"%}
+
+ {{ item.closing.date }} {%trans "by" %} {{ item.closing.user }} +
+
+ {% endif %} + {% field_flex_2 "Type" item.operation_type %} + {% if item.surface %} +
+
{%trans "Surface"%}
+
+ {{ item.surface }} m2 ({{ item.surface_ha }} ha) +
+
+ {% endif %} + {% if item.cost %} +
+
{%trans "Cost" %}
+
+ {{ item.cost }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/m2){%endif%} +
+
+ {% endif %} + {% if item.duration %} +
+
{%trans "Duration"%}
+
+ {{ item.duration }} {% trans "days" %} +
+
+ {% endif %} + {% if has_image %}
- {%endif%} - {% if item.duration %} -
-
{%trans "Duration"%}
-
- {{ item.duration }} {% trans "days" %} -
+ {% endif %} + {% endwith %}
- {%endif%} +
+
{% field_flex_multiple "Remains" item.remains %} {% field_flex_multiple "Periods" item.periods %} {% field_flex "Record quality" item.record_quality_type %} @@ -116,6 +126,11 @@ {% field_flex_full "Comment about scientific documentation" item.scientific_documentation_comment "
" "
" %}
+

{% trans "Sheet"%}

+
+ {% include "ishtar/blocks/sheet_creation_section.html" %} +
+ {% include "ishtar/blocks/sheet_json.html" %} {% if item.virtual_operation %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html index 5968f9afa..6f5d80ba8 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html @@ -1,5 +1,5 @@ {% load i18n %}{% if item %} -
+
{% trans caption %}
{{item}}{{link}}
diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html index 60f6361b7..010200837 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html @@ -1,5 +1,5 @@ {% load i18n %}{% if data.count %} -
+
{% trans caption %}
{% for d in data.all %} {% if forloop.counter0 %} ; {% endif %}{{ d }} diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py index f1db8cf48..46329a3fa 100644 --- a/ishtar_common/templatetags/window_field.py +++ b/ishtar_common/templatetags/window_field.py @@ -34,8 +34,11 @@ def field_li(caption, data, pre_data='', post_data=''): @register.inclusion_tag('ishtar/blocks/window_field_flex.html') -def field_flex(caption, data, pre_data='', post_data=''): - return field(caption, data, pre_data, post_data) +def field_flex(caption, data, pre_data='', post_data='', small=False): + size = None + if small: + size = 2 + return field(caption, data, pre_data, post_data, size=size) @register.inclusion_tag('ishtar/blocks/window_field_flex.html') @@ -44,8 +47,11 @@ def field_flex_2(caption, data, pre_data='', post_data=''): @register.inclusion_tag('ishtar/blocks/window_field_flex_full.html') -def field_flex_full(caption, data, pre_data='', post_data=''): - return field(caption, data, pre_data, post_data) +def field_flex_full(caption, data, pre_data='', post_data='', small=False): + size = None + if small: + size = 2 + return field(caption, data, pre_data, post_data, size=size) @register.inclusion_tag('ishtar/blocks/window_field_url.html') @@ -85,8 +91,8 @@ def field_flex_file(context, caption, link): @register.inclusion_tag('ishtar/blocks/window_field_multiple.html') -def field_multiple(caption, data, li=False): - return {'caption': caption, 'data': data, 'li': li} +def field_multiple(caption, data, li=False, size=None): + return {'caption': caption, 'data': data, 'li': li, "size": size} @register.inclusion_tag('ishtar/blocks/window_field_multiple.html') @@ -95,14 +101,17 @@ def field_li_multiple(caption, data): @register.inclusion_tag('ishtar/blocks/window_field_flex_multiple.html') -def field_flex_multiple(caption, data): - return field_multiple(caption, data) +def field_flex_multiple(caption, data, small=False): + size = None + if small: + size = 2 + return field_multiple(caption, data, size=size) @register.inclusion_tag('ishtar/blocks/window_field_detail.html') -def field_detail(caption, item, li=False): +def field_detail(caption, item, li=False, size=None): return {'caption': caption, 'item': item, 'link': link_to_window(item), - 'li': li} + 'li': li, 'size': size} @register.inclusion_tag('ishtar/blocks/window_field_detail.html') @@ -111,5 +120,8 @@ def field_li_detail(caption, item): @register.inclusion_tag('ishtar/blocks/window_field_flex_detail.html') -def field_flex_detail(caption, item): - return field_detail(caption, item) +def field_flex_detail(caption, item, small=False): + size = None + if small: + size = 2 + return field_detail(caption, item, size=size) diff --git a/scss/custom.scss b/scss/custom.scss index e0b9cbe74..2406a1d98 100644 --- a/scss/custom.scss +++ b/scss/custom.scss @@ -290,10 +290,14 @@ textarea { background-color: $gray-200; } -.sheet .row{ +.sheet .row.toolbar{ padding: 0.5em 0.75em; } +.sheet .row{ + padding: 0 0.75em; +} + .clean-table h4{ margin-top: 1em; } -- cgit v1.2.3