[build][xs]: build recline.js with latest fixes to map view.

This commit is contained in:
Rufus Pollock
2012-04-11 19:28:43 +01:00
parent 8092b563b3
commit 521322955a

View File

@@ -1528,15 +1528,18 @@ my.Map = Backbone.View.extend({
// //
// Each feature will have a popup associated with all the document fields. // Each feature will have a popup associated with all the document fields.
// //
_add: function(doc){ _add: function(docs){
var self = this; var self = this;
if (!(doc instanceof Array)) doc = [doc]; if (!(docs instanceof Array)) docs = [docs];
doc.forEach(function(doc){ _.every(docs,function(doc){
var feature = self._getGeometryFromDocument(doc); var feature = self._getGeometryFromDocument(doc);
if (feature instanceof Object){ if (typeof feature === 'undefined'){
// Empty field
return true;
} else if (feature instanceof Object){
// Build popup contents // Build popup contents
// TODO: mustache? // TODO: mustache?
html = '' html = ''
@@ -1555,24 +1558,25 @@ my.Map = Backbone.View.extend({
var msg = 'Wrong geometry value'; var msg = 'Wrong geometry value';
if (except.message) msg += ' (' + except.message + ')'; if (except.message) msg += ' (' + except.message + ')';
my.notify(msg,{category:'error'}); my.notify(msg,{category:'error'});
_.breakLoop(); return false;
} }
} else { } else {
my.notify('Wrong geometry value',{category:'error'}); my.notify('Wrong geometry value',{category:'error'});
_.breakLoop(); return false;
} }
return true;
}); });
}, },
// Private: Remove one or n features to the map // Private: Remove one or n features to the map
// //
_remove: function(doc){ _remove: function(docs){
var self = this; var self = this;
if (!(doc instanceof Array)) doc = [doc]; if (!(docs instanceof Array)) docs = [docs];
doc.forEach(function(doc){ _.each(doc,function(doc){
for (key in self.features._layers){ for (key in self.features._layers){
if (self.features._layers[key].cid == doc.cid){ if (self.features._layers[key].cid == doc.cid){
self.features.removeLayer(self.features._layers[key]); self.features.removeLayer(self.features._layers[key]);