summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-02-14 16:31:17 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-04-24 19:38:56 +0200
commit16b54ce820e0f522164a12819ffc18197be59b33 (patch)
tree58d4f80dd68b4ee19444a4cfda604e6665af6da8
parenta8df13b353369c83896320212c0f90a8e805d2ca (diff)
downloadIshtar-16b54ce820e0f522164a12819ffc18197be59b33.tar.bz2
Ishtar-16b54ce820e0f522164a12819ffc18197be59b33.zip
Sheet operation: display map
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html30
-rw-r--r--ishtar_common/models.py7
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_coordinates.html3
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 @@
</div>
{% endif %}
-{% if next %}
-{% if item|m2m_listing:'towns' %}
<h3>{% trans "Localisation"%}</h3>
<div class="row">
- {% field_flex_full "Towns" item|m2m_listing:'towns'|join:" ; " %}
-</div>
-{% endif %}
-{% else %}
-{% if item.towns.count %}
-<h3>{% trans "Localisation"%}</h3>
-<div class="row">
- {% 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"%}
+ <div class="col-12 col-lg-6 flex-wrap">
+ {% 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 %}
+ </div>
+ {% endwith %}
</div>
-{% endif %}
{% if item.right_relations.count %}
<h3>{% trans "Relations"%}</h3>
@@ -364,6 +364,4 @@
</div>
{% 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 %}
<dl class="col-12 d-flex flex-wrap">
<dt class="col-12">{% trans "Coordinates" %}</dt>
<dd class="col-12">
@@ -14,4 +14,5 @@
{% endif %}
</dd>
</dl>
+{% field_flex_full "Point source" geo_item.geo_point_source %}
{% endif %}