allow updating options.places with an array

This commit is contained in:
j 2012-07-02 18:17:52 +02:00
parent 487ee4626d
commit 2e5205fabe

View file

@ -117,6 +117,17 @@ Ox.Map = function(options, self) {
that.resizeMap(); that.resizeMap();
}, },
places: function() { 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(); addPlaces();
getMapBounds(function(mapBounds) { getMapBounds(function(mapBounds) {
if (mapBounds) { if (mapBounds) {
@ -240,6 +251,7 @@ Ox.Map = function(options, self) {
} }
}); });
//FIXME: duplicated in update
if (Ox.isArray(self.options.places)) { if (Ox.isArray(self.options.places)) {
self.options.places.forEach(function(place) { self.options.places.forEach(function(place) {
if (Ox.isUndefined(place.id)) { if (Ox.isUndefined(place.id)) {