forked from 0x2620/pandora
in MapEditor getMatches, return when names.length is 0
This commit is contained in:
parent
a1c7b88f08
commit
65a5e58436
1 changed files with 19 additions and 14 deletions
|
@ -22,24 +22,29 @@ pandora.ui.placesDialog = function(options) {
|
||||||
getMatches: function(names, callback) {
|
getMatches: function(names, callback) {
|
||||||
// fixme: the results of this are of course
|
// fixme: the results of this are of course
|
||||||
// not identical to actual place matches
|
// not identical to actual place matches
|
||||||
names.length == 0 && callback(0);
|
var key, operator;
|
||||||
var key = pandora.site.layers.filter(function(layer) {
|
if (names.length == 0) {
|
||||||
|
callback(0);
|
||||||
|
} else {
|
||||||
|
key = pandora.site.layers.filter(function(layer) {
|
||||||
return layer.type == 'place' || layer.hasPlaces;
|
return layer.type == 'place' || layer.hasPlaces;
|
||||||
}).map(function(layer) {
|
}).map(function(layer) {
|
||||||
return layer.id;
|
return layer.id;
|
||||||
})[0],
|
})[0],
|
||||||
operator = Ox.getObjectById(pandora.site.layers, key).type == 'place' ?
|
operator = Ox.getObjectById(
|
||||||
'==' : '=';
|
pandora.site.layers, key
|
||||||
pandora.api.findClips({
|
).type == 'place' ? '==' : '=';
|
||||||
query: {
|
pandora.api.findClips({
|
||||||
conditions: names.map(function(name) {
|
query: {
|
||||||
return {key: key, value: name, operator: operator};
|
conditions: names.map(function(name) {
|
||||||
}),
|
return {key: key, value: name, operator: operator};
|
||||||
operator: names.length == 1 ? '&' : '|'
|
}),
|
||||||
}
|
operator: names.length == 1 ? '&' : '|'
|
||||||
}, function(result) {
|
}
|
||||||
callback(result.data.items);
|
}, function(result) {
|
||||||
});
|
callback(result.data.items);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hasMatches: true, // FIXME: getMatches is enough
|
hasMatches: true, // FIXME: getMatches is enough
|
||||||
height: height - 48,
|
height: height - 48,
|
||||||
|
|
Loading…
Reference in a new issue