add export dialog; use it in manage places/events/users
This commit is contained in:
parent
4754f86909
commit
e1913a1d05
4 changed files with 125 additions and 27 deletions
|
|
@ -89,6 +89,38 @@ pandora.ui.placesDialog = function(options) {
|
|||
}
|
||||
}),
|
||||
{},
|
||||
Ox.Button({
|
||||
id: 'exportPlaces',
|
||||
title: Ox._('Export Places...')
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
var $button = this,
|
||||
keys = [
|
||||
'name', 'alternativeNames', 'geoname',
|
||||
'lat', 'lng', 'south', 'west', 'north', 'east'
|
||||
];
|
||||
$button.options({disabled: true});
|
||||
pandora.api.findPlaces({
|
||||
query: {conditions: [], operator: '&'},
|
||||
keys: keys,
|
||||
range: [0, 1000000],
|
||||
sort: [{key: 'name', operator: '+'}]
|
||||
}, function(result) {
|
||||
pandora.ui.exportDialog({
|
||||
data: JSON.stringify(result.data.items.map(function(item) {
|
||||
Object.keys(item).filter(function(key) {
|
||||
return !Ox.contains(keys, key);
|
||||
}).forEach(function(key) {
|
||||
delete item[key];
|
||||
});
|
||||
return item;
|
||||
}), null, ' '),
|
||||
title: Ox._('Places')
|
||||
}).open();
|
||||
$button.options({disabled: false});
|
||||
});
|
||||
}
|
||||
}),
|
||||
Ox.Button({
|
||||
id: 'done',
|
||||
title: Ox._('Done'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue