From 2e5205fabe8690ae30c57306b86fa833b43e4cf2 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 2 Jul 2012 18:17:52 +0200 Subject: [PATCH] allow updating options.places with an array --- source/Ox.UI/js/Map/Map.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/Ox.UI/js/Map/Map.js b/source/Ox.UI/js/Map/Map.js index 8786006a..8bcf239a 100644 --- a/source/Ox.UI/js/Map/Map.js +++ b/source/Ox.UI/js/Map/Map.js @@ -117,6 +117,17 @@ Ox.Map = function(options, self) { that.resizeMap(); }, places: function() { + if (Ox.isArray(self.options.places)) { + self.options.places.forEach(function(place) { + if (Ox.isUndefined(place.id)) { + place.id = Ox.encodeBase32(Ox.uid()); + } + }); + self.options.places = Ox.api(self.options.places, { + geo: true, + sort: '-area' + }); + } addPlaces(); getMapBounds(function(mapBounds) { if (mapBounds) { @@ -240,6 +251,7 @@ Ox.Map = function(options, self) { } }); + //FIXME: duplicated in update if (Ox.isArray(self.options.places)) { self.options.places.forEach(function(place) { if (Ox.isUndefined(place.id)) {