split up pandora.js
This commit is contained in:
parent
1e985ebf63
commit
88a976b12d
41 changed files with 4508 additions and 3931 deletions
67
static/js/pandora/ui/placesDialog.js
Normal file
67
static/js/pandora/ui/placesDialog.js
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.placesDialog = function() {
|
||||
var height = Math.round(document.height * 0.8),
|
||||
width = Math.round(document.width * 0.8),
|
||||
that = new Ox.Dialog({
|
||||
buttons: [
|
||||
new Ox.Button({
|
||||
id: 'done',
|
||||
title: 'Done'
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
}
|
||||
})
|
||||
],
|
||||
content: app.$ui.placesElement = new Ox.ListMap({
|
||||
height: height - 48,
|
||||
places: function(data, callback) {
|
||||
return pandora.api.findPlaces($.extend(data, {
|
||||
query: {conditions: [], operator: ''}
|
||||
}), callback);
|
||||
},
|
||||
width: width
|
||||
})
|
||||
.bindEvent({
|
||||
addplace: function(event, data) {
|
||||
Ox.print('ADDPLACE', data)
|
||||
pandora.api.addPlace(data.place, function(result) {
|
||||
var id = result.data.id;
|
||||
Ox.print("ID", result.data.id, result)
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
Ox.print('AAAAA')
|
||||
app.$ui.placesElement
|
||||
.reloadList()
|
||||
.bindEventOnce({
|
||||
loadlist: function() {
|
||||
app.$ui.placesElement
|
||||
.focusList()
|
||||
.options({selected: [id]});
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
removeplace: function(event, data) {
|
||||
pandora.api.removePlace(data.id, function(result) {
|
||||
// fixme: duplicated
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
app.$ui.placesElement
|
||||
.reloadList()
|
||||
.bindEventOnce({
|
||||
loadlist: function(event, data) {
|
||||
app.$ui.placesElement
|
||||
.focusList();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}),
|
||||
height: height,
|
||||
keys: {enter: 'done', escape: 'done'},
|
||||
padding: 0,
|
||||
title: 'Manage Places',
|
||||
width: width
|
||||
});
|
||||
return that;
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue