diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models_common.py | 10 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_geo_items.html | 23 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_simple_map.html | 14 | 
3 files changed, 23 insertions, 24 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index cf994c8c0..08cfabdab 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2880,16 +2880,16 @@ class GeoItem(models.Model):              dict["geometry"]["coordinates"] = list_coords          else:              dict["geometry"]["type"] = "Point" -            if self.multi_polygon: -                dict["geometry"]["coordinates"] = self.convert_coordinates( -                    self.multi_polygon.centroid, rounded -                ) -            else: +            if self.point_2d:                  try:                      x, y = self.display_coordinates                      dict["geometry"]["coordinates"] = [x, y]                  except ValueError:                      dict["geometry"]["coordinates"] = [] +            else: +                dict["geometry"]["coordinates"] = self.convert_coordinates( +                    self.multi_polygon.centroid, rounded +                )          return dict      def convert_coordinates(self, point_2d, rounded): diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html index 9b485de15..36fbabfcf 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html @@ -24,18 +24,17 @@  </dl>  <script>  var hide_get_polygons = function() { -    const disp = $("#display-geo-items")[0]; -    const get_poly = $("#get-polygons")[0]; -    const label = $("#label-get-polygons")[0]; -    get_poly.hidden = true; -    label.hidden = true; -    disp.addEventListener('change', (event) => { -        if (event.target.value === "") { -            get_poly.hidden = true; -            label.hidden = true; -            get_poly.value = ""; -        } else { get_poly.hidden = false; -            label.hidden = false;} +    const disp = $("#display-geo-items"); +    const get_poly = $("#get-polygons"); +    const label = $("#label-get-polygons"); +    get_poly.hide(); +    label.hide(); +    disp.change( function () { +        if (disp.val() === "") { +            get_poly.hide(); +            label.hide(); +        } else { get_poly.show(); +            label.show();}      })  }  hide_get_polygons(); diff --git a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html index 2c9d49be2..b4e669a70 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html @@ -38,20 +38,20 @@ var display_geo_items = function(disp, get_polygons) {  }  var geo_items_displayed_once = false; -var disp = $("#display-geo-items")[0]; -var get_polygons = $("#get-polygons")[0]; -disp.addEventListener('change', (event) => { +var disp = $("#display-geo-items"); +var get_polygons = $("#get-polygons"); +disp.change( function () {      if (geo_items_displayed_once) {          disp_map();      } -    if (disp.value !== "") { -        display_geo_items(disp.value, get_polygons.value); +    if (disp.val() !== "") { +        display_geo_items(disp.val(), get_polygons.val());          geo_items_displayed_once = true;      }  }) -get_polygons.addEventListener('change', (event) => { +get_polygons.change( function () {      disp_map(); -    display_geo_items(disp.value, get_polygons.value); +    display_geo_items(disp.val(), get_polygons.val());  })  {% endif %}  </script>  | 
