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();
},
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)) {