1
0
Fork 0
forked from 0x2620/oxjs

update list when editing place

This commit is contained in:
rolux 2011-05-29 19:44:48 +02:00
commit 25b86dd085
3 changed files with 78 additions and 32 deletions

View file

@ -46,6 +46,27 @@ Ox.load('Geo', function() {
});
var $listmap = new Ox.ListMap({
addPlace: function(data, callback) {
var id = Ox.encodeBase32(Ox.uid());
Ox.print('addplace', getGeonameSort(data.place.geoname));
places.push(Ox.extend(data.place, {
geonameSort: getGeonameSort(data.place.geoname),
id: id
}));
callback({
data: {id: id},
result: {code: 200, text: 'OK'}
});
},
editPlace: function(data, callback) {
var place = Ox.getObjectById(places, data.id);
place = Ox.extend(place, data, {
geonameSort: getGeonameSort(data.geoname)
});
callback({
result: {code: 200, text: 'OK'}
});
},
height: window.innerHeight,
places: function(options, callback) {
// this simulates a remote API
@ -134,23 +155,17 @@ Ox.load('Geo', function() {
result: {code: 200, text: 'OK'}
});
},
removePlace: function(data, callback) {
var i = Ox.getPositionById(places, data.id);
places.splice(i, 1);
callback();
},
width: window.innerWidth
})
.bindEvent({
addplace: function(data) {
Ox.print('addplace', getGeonameSort(data.place.geoname));
places.push(Ox.extend(data.place, {
geonameSort: getGeonameSort(data.place.geoname),
id: Ox.encodeBase32(Ox.uid())
}));
},
geocode: function(event, data) {
Ox.print(event)
Ox.print(JSON.stringify(data))
},
removeplace: function(data) {
var i = Ox.getPositionById(places, data.id);
places.splice(i, 1);
}
})
.appendTo(Ox.UI.$body);