use getMatches option of ListMap

This commit is contained in:
rolux 2011-10-30 14:59:54 +00:00
parent e71421f597
commit b2550c81d7
3 changed files with 19 additions and 4 deletions

View file

@ -55,6 +55,7 @@ pandora.UI = (function() {
// switch from item view to list view // switch from item view to list view
args['item'] = ''; args['item'] = '';
} }
add['itemFind'] = pandora.site.user.ui.itemFind;
if (!pandora.user.ui.lists[list]) { if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {}; add['lists.' + that.encode(list)] = {};
} }

View file

@ -174,10 +174,10 @@ pandora.ui.item = function() {
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
find: function(data) { find: function(data) {
pandora.UI.set('itemFind', { pandora.UI.set('itemFind', data.find ? {
conditions: [{key: 'subtitles', value: data.find, operator: '='}], conditions: [{key: 'subtitles', value: data.find, operator: '='}],
operator: '&' operator: '&'
}); } : pandora.site.user.ui.itemFind);
}, },
muted: function(data) { muted: function(data) {
pandora.UI.set('muted', data.muted); pandora.UI.set('muted', data.muted);
@ -241,10 +241,10 @@ pandora.ui.item = function() {
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
find: function(data) { find: function(data) {
pandora.UI.set('itemFind', { pandora.UI.set('itemFind', data.find ? {
conditions: [{key: 'subtitles', value: data.find, operator: '='}], conditions: [{key: 'subtitles', value: data.find, operator: '='}],
operator: '&' operator: '&'
}); } : pandora.site.user.ui.itemFind);
}, },
points: function(data) { points: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item, { pandora.UI.set('videoPoints.' + pandora.user.ui.item, {

View file

@ -22,6 +22,20 @@ pandora.ui.placesDialog = function() {
callback(result); callback(result);
}); });
}, },
getMatches: function(names, callback) {
// fixme: the results of this are of course
// not identical to actual place matches
pandora.api.findClips({
query: {
conditions: names.map(function(name) {
return {key: 'subtitles', value: name, operator: '='};
}),
operator: names.length == 1 ? '&' : '|'
}
}, function(result) {
callback(result.data.items);
});
},
removePlace: function(place, callback) { removePlace: function(place, callback) {
pandora.api.removePlace(place, function(result) { pandora.api.removePlace(place, function(result) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove