pandora/static/js/pandora/ui/placesDialog.js

54 lines
2 KiB
JavaScript
Raw Normal View History

2011-05-25 19:42:45 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.placesDialog = function() {
2011-06-02 07:01:29 +00:00
var height = Math.round(window.innerHeight * 0.9),
width = Math.round(window.innerWidth * 0.9),
2011-05-25 19:42:45 +00:00
that = new Ox.Dialog({
buttons: [
new Ox.Button({
id: 'done',
title: 'Done'
}).bindEvent({
click: function() {
that.close();
}
})
],
2011-06-06 15:48:11 +00:00
content: pandora.$ui.placesElement = new Ox.ListMap({
2011-05-25 19:42:45 +00:00
height: height - 48,
places: function(data, callback) {
return pandora.api.findPlaces($.extend({
2011-05-25 19:42:45 +00:00
query: {conditions: [], operator: ''}
}, data), callback);
2011-05-25 19:42:45 +00:00
},
2011-05-30 09:06:28 +00:00
addPlace: function(place, callback) {
Ox.print('ADDPLACE', place);
pandora.api.addPlace(place, function(result) {
2011-05-29 20:01:33 +00:00
Ox.Request.clearCache(); // fixme: remove
callback(result);
});
2011-05-25 19:42:45 +00:00
},
2011-05-30 09:06:28 +00:00
editPlace: function(place, callback) {
Ox.print('EDITPLACE', place);
pandora.api.editPlace(place, callback);
2011-05-29 19:45:31 +00:00
},
2011-05-30 09:06:28 +00:00
removePlace: function(place, callback) {
Ox.print('REMOVEPLACE', place);
pandora.api.removePlace(place, function(result) {
Ox.Request.clearCache(); // fixme: remove
callback(result);
});
2011-05-29 19:45:31 +00:00
},
2011-05-30 13:41:56 +00:00
showTypes: true,
2011-05-29 19:45:31 +00:00
width: width
2011-05-25 19:42:45 +00:00
}),
height: height,
2011-06-02 08:03:41 +00:00
//keys: {enter: 'done', escape: 'done'},
2011-05-25 19:42:45 +00:00
padding: 0,
title: 'Manage Places',
width: width
});
return that;
};