diff options
3 files changed, 104 insertions, 79 deletions
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 93a9b67d2..4fa98c6a9 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -1,7 +1,7 @@ {% extends "ishtar/sheet.html" %} {% load i18n window_field window_header window_tables window_field %} -{% block head_title %}{% trans "Context Record:" %}{{item.full_label}}{% endblock %} +{% block head_title %}<strong>{% trans "Context Record" %}</strong> - {{item.full_label}}{% endblock %} {% block toolbar %} {% window_nav item window_id 'show-contextrecord' 'record_modify' 'show-historized-contextrecord' 'revert-contextrecord' previous next 1 %} @@ -9,65 +9,73 @@ {% block content %} -{% if item.image %} -<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a> -{% endif%} - -<p class='window-refs'>{{ item.parcel.short_label }}</p> -<p class="window-refs">{{ item.label|default:"" }}</p> -{% include "ishtar/blocks/sheet_external_id.html" %} - -<ul class='form-flex'> -<li><label>{% if item.operation.code_patriarche %}{%trans "Complete ID"%}{% else %}{%trans "Temporary ID"%}{% endif %}</label><span class='value'>{{item.full_label}}</span></li> - +<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"> + {% if item.image %} + <img class='card-img-top' src="{{item.thumbnail.url}}"> + {% endif%} + <div class="card-body"> + <p class="card-text"> + <p class='window-refs'>{{ item.parcel.short_label }}</p> + <p class="window-refs">{{ item.label|default:"" }}</p> + {% include "ishtar/blocks/sheet_external_id.html" %} + </p> + </div> + </div> + </div> +</div> + + + +<div class='row'> + {% field_flex "Complete ID" item.full_label %} {% include "ishtar/blocks/sheet_creation_section.html" %} - - {% field_li "Type" item.unit %} - {% field_li "Excavation technic" item.excavation_technic %} - {% field_li_multiple "Chronology" item.datings %} - {% field_li "Town" item.parcel.town %} - {% field_li_multiple "Documentation" item.documentations %} - {% field_li "Opening date" item.opening_date %} - {% field_li "Closing date" item.closing_date %} -</ul> -{% field "Comment on datings" item.datings_comment "<pre>" "</pre>" %} + {% field_flex "Type" item.unit %} + {% field_flex "Excavation technic" item.excavation_technic %} + {% field_flex_multiple "Chronology" item.datings %} + {% field_flex "Town" item.parcel.town %} + {% 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 "<pre>" "</pre>" %} +</div> {% include "ishtar/blocks/sheet_json.html" %} {% 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 %} <h3>{% trans "Description"%}</h3> -{% field "Description" item.description "<pre>" "</pre>" %} -{% field "Comment" item.comment "<pre>" "</pre>" %} -<ul class='form-flex'> - {% field_li "Length (m)" item.lenght %} - {% field_li "Width (m)" item.width %} - {% field_li "Diameter (m)" item.diameter %} - {% field_li "Depth (m)" item.depth %} - {% field_li "Thickness (m)" item.thickness %} - {% field_li "Depth of appearance (m)" item.depth_of_appearance %} -</ul> +<div class='row'> + {% field_flex_full "Description" item.description "<pre>" "</pre>" %} + {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} + {% 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 %} +</div> {% endif %} {% if item.activity or item.identification or item.interpretation %} <h3>{% trans "Interpretation"%}</h3> - -<ul class='form-flex'> - {% field_li_multiple "Documentation" item.documentations %} - {% field_li "Activity" item.activity %} - {% field_li "Identification" item.identification %} -</ul> -{% field "Filling" item.filling "<pre>" "</pre>" %} -{% field "Interpretation" item.interpretation "<pre>" "</pre>" %} +<div class='row'> + {% field_flex_multiple "Documentation" item.documentations %} + {% field_flex "Activity" item.activity %} + {% field_flex "Identification" item.identification %} + {% field_flex_full "Filling" item.filling "<pre>" "</pre>" %} + {% field_flex_full "Interpretation" item.interpretation "<pre>" "</pre>" %} +</div> {% endif %} {% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %} <h3>{% trans "Datations"%}</h3> -<ul class='form-flex'> -{% field_li "TAQ" item.taq %} -{% field_li "Estimated TAQ" item.taq_estimated %} -{% field_li "TPQ" item.tpq %} -{% field_li "Estimated TPQ" item.tpq_estimated %} -</ul> +<div class='row'> + {% field_flex "TAQ" item.taq %} + {% field_flex "Estimated TAQ" item.taq_estimated %} + {% field_flex "TPQ" item.tpq %} + {% field_flex "Estimated TPQ" item.tpq_estimated %} +</div> {% endif %} {% trans "Context record relations" as cr_rels %} @@ -79,31 +87,48 @@ {% if item.operation %} <h3>{% trans "Operation summary"%}</h3> {% if not item.operation.code_patriarche %} -<p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <label>{%trans "Patriarche OA code not yet recorded!"%}</label></p> +<div class="alert alert-warning" role="alert"> + {%trans "Patriarche OA code not yet recorded!"%} +</div> {% endif %} -<ul class='form-flex'> -{% field_li "Year" item.operation.year %} +<div class='row'> + {% field_flex "Year" item.operation.year %} {% trans "Numerical reference" as num_ref_label %} - {% field_li num_ref_label item.operation.operation_code %} -{% field_li "Patriarche OA code" item.operation.code_patriarche %} -{% field_li_detail "Head scientist" item.operation.scientist %} -<li><label>{%trans "State"%}</label><span class='value'>{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}</span></li> -{% if not item.operation.is_active %} -<li><label>{%trans "Closing date"%}</label> <span class='value'>{{ item.operation.closing.date }} <strong>{%trans "by" %}</strong> {{ item.operation.closing.user }}</span></li> -{% endif %} -{% field_li "Type" item.operation.operation_type %} -{% field_li_multiple "Remains" item.operation.remains %} -{% field_li_multiple "Periods" item.operation.periods %} -</ul> -{% field "Comment" item.operation.comment "<pre>" "</pre>" %} + {% 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 %} + + <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> + <dt class="col-5">{% trans "State" %}</dt> + <dd class="col-7">{% if item.operation.is_active %}{% trans "Active file" %}{% else %}{%trans "Closed operation" %}{% endif %}</dd> + </dl> + + {% if not item.operation.is_active %} + <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> + <dt class="col-5">{%trans "Closing date"%}</dt> + <dd class="col-7"> + {{ item.operation.closing.date }} <strong>{%trans "by" %}</strong> {{ item.operation.closing.user }} + </dd> + </dl> + {% 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 "<pre>" "</pre>" %} +</div> <h3>{% trans "Localisation"%}</h3> -<p><label>{%trans "Towns"%}</label> <span class='value'>{{ item.operation.towns.all|join:", " }}</span></p> -<p><label>{%trans "Related operation"%}</label> -<span class='value'><a href="#" onclick='load_window("{% url "show-operation" item.operation.pk ''%}");'>{{ item.operation }}</a></span></p> -{% else %}<p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <label>{%trans "No operation linked to this context unit!"%}</label></p> -{% endif %} +<div class='row'> + {% field_flex_multiple "Towns" item.operation.towns %} + {% field_flex_detail "Operation" item.operation %} +</div> + +{% else %} +<div class="alert alert-warning" role="alert"> + {% trans "No operation linked to this context record!" %} +</div> +{% endif %} {% trans "Document from this context record" as cr_docs %} {% if item.source.count %} {% dynamic_table_document cr_docs 'context_records_docs' 'context_record' item.pk '' output %} diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 5c3b91e9f..58fa8b8c6 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -645,7 +645,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, q = self.context_record.values( 'unit', 'unit__label').distinct().order_by('label') for res in q.all(): - nbs.append((unicode(res['unit__label']), + nbs.append((unicode(res['unit__label'] or "-"), self.context_record.filter(unit=res['unit']).count())) return list(set(nbs)) @@ -659,7 +659,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'datings__period', 'datings__period__label').distinct().order_by( 'datings__period__order') for res in q.all(): - nbs.append((unicode(res['datings__period__label']), + nbs.append((unicode(res['datings__period__label'] or "-"), self.context_record.filter( datings__period=res['datings__period']).count())) return nbs @@ -690,7 +690,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'material_types__label') for res in q.all(): nbs.append( - (unicode(res['material_types__label']), + (unicode(res['material_types__label'] or "-"), Find.objects.filter( base_finds__context_record__operation=self, upstream_treatment_id__isnull=True, @@ -733,7 +733,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'datings__period__order') for res in q.all(): nbs.append( - (unicode(res['datings__period__label']), + (unicode(res['datings__period__label'] or "-"), Find.objects.filter( base_finds__context_record__operation=self, upstream_treatment_id__isnull=True, diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 1f3e9e157..565bccbb2 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -229,20 +229,20 @@ <div class='row'> {% if item.nb_context_records_by_type %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_context_records_by_type %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> {% endif %} {% if item.nb_context_records_by_periods %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_context_records_by_periods %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> @@ -256,17 +256,17 @@ <div class='row'> {% if item.nb_finds_by_material_type %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Material type" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_finds_by_material_type %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> {% endif %} {% if item.nb_finds_by_types %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Object type" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_finds_by_types %} <tr><td>{{label}}</td><td>{{nb}}</td></tr> @@ -276,10 +276,10 @@ {% endif %} {% if item.nb_finds_by_periods %} <div class="col-12 col-md-6 col-lg-4"> - <table> + <table class="table"> <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr> {% for label, nb in item.nb_finds_by_periods %} - <tr><td>{{label}}</td><td>{{nb}}</td></tr> + <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr> {% endfor %} </table> </div> |