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

57 lines
2.1 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-05-25 19:42:45 +00:00
pandora.ui.placesDialog = function() {
2011-08-17 11:39:55 +00:00
var height = Math.round((window.innerHeight - 48) * 0.9),
2011-06-02 07:01:29 +00:00
width = Math.round(window.innerWidth * 0.9),
2011-06-19 17:49:25 +00:00
that = Ox.Dialog({
2011-05-25 19:42:45 +00:00
buttons: [
2011-06-19 17:49:25 +00:00
Ox.Button({
2011-05-25 19:42:45 +00:00
id: 'done',
title: 'Done'
}).bindEvent({
click: function() {
that.close();
}
})
],
2011-08-17 11:39:55 +00:00
closeButton: true,
2011-06-19 17:49:25 +00:00
content: pandora.$ui.placesElement = 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);
2011-06-20 16:15:15 +00:00
pandora.api.removePlace(place.id, 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-08-17 11:39:55 +00:00
maximizeButton: true,
minHeight: 256,
minWidth: 512,
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;
};