From 16b54ce820e0f522164a12819ffc18197be59b33 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 14 Feb 2019 16:31:17 +0100 Subject: Sheet operation: display map --- .../templates/ishtar/sheet_operation.html | 30 ++++++++++------------ ishtar_common/models.py | 7 +++++ .../templates/ishtar/blocks/sheet_coordinates.html | 3 ++- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index f13a21336..6ed3c1b4c 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -155,23 +155,23 @@ {% endif %} -{% if next %} -{% if item|m2m_listing:'towns' %}

{% trans "Localisation"%}

- {% field_flex_full "Towns" item|m2m_listing:'towns'|join:" ; " %} -
-{% endif %} -{% else %} -{% if item.towns.count %} -

{% trans "Localisation"%}

-
- {% field_flex_full "Towns" item.towns_codes|join:" ; " %} - {% field_flex "Main address" item.associated_file.address %} - {% field_flex "Complement" item.associated_file.address_complement %} - {% field_flex "Postal code" item.associated_file.postal_code %} + {% with geo_item=item %} + {% include "ishtar/blocks/sheet_simple_map.html"%} +
+ {% include "ishtar/blocks/sheet_coordinates.html"%} + {% if next %} + {% field_flex_full "Towns" item|m2m_listing:'towns'|join:" ; " %} + {% else %} + {% field_flex_full "Towns" item.towns_codes|join:" ; " %} + {% endif %} + {% field_flex "Main address" item.associated_file.address %} + {% field_flex "Complement" item.associated_file.address_complement %} + {% field_flex "Postal code" item.associated_file.postal_code %} +
+ {% endwith %}
-{% endif %} {% if item.right_relations.count %}

{% trans "Relations"%}

@@ -364,6 +364,4 @@ {% endif %} -{% endif %} - {% endblock %} \ No newline at end of file diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 8c421bac7..8d3d5df9a 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1613,6 +1613,13 @@ class DocumentItem(object): class GeoItem(object): + GEO_SOURCE = ('T', _(u"Town")), ('P', _(u"Precise")) + + def geo_point_source(self): + if not self.point_source: + return "" + return dict(self.GEO_SOURCE)[self.point_source] + def _geojson_serialize(self, geom_attr): if not hasattr(self, geom_attr): return "" diff --git a/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html b/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html index c29f7de61..8637853e3 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html @@ -1,4 +1,4 @@ -{% load i18n %}{% if geo_item.x or geo_item.y or geo_item.z %} +{% load i18n window_field %}{% if geo_item.x or geo_item.y or geo_item.z %}
{% trans "Coordinates" %}
@@ -14,4 +14,5 @@ {% endif %}
+{% field_flex_full "Point source" geo_item.geo_point_source %} {% endif %} -- cgit v1.2.3