1
0
Fork 0
forked from 0x2620/oxjs

improve listmap editing functionality

This commit is contained in:
rolux 2011-05-24 10:40:17 +02:00
commit 76606689d7
2 changed files with 71 additions and 41 deletions

View file

@ -347,37 +347,53 @@ Ox.ListMap = function(options, self) {
});
self.$newPlaceButton = Ox.Button({
disabled: true,
title: 'New',
width: 64
title: 'New Place',
width: 96
})
.css({float: 'left', margin: '4px'})
.hide()
.bindEvent({
click: function() {
self.$map.newPlace();
}
})
.appendTo(self.$placeStatusbar);
self.$removePlaceButton = Ox.Button({
disabled: true,
title: 'Remove',
width: 64
title: 'Remove Place',
width: 96
})
.css({float: 'left', margin: '4px'})
.hide()
.bindEvent({
click: function() {
self.$map.removePlace(self.selectedPlace);
self.$removePlaceButton.hide();
self.$addPlaceButton.show();
}
})
.appendTo(self.$placeStatusbar);
self.$addPlaceButton = Ox.Button({
disabled: true,
title: 'Add',
width: 64
title: 'Add Place',
width: 96
})
.css({float: 'left', margin: '4px'})
.bindEvent({
click: function() {
self.$map.addPlace(self.$placeForm.values);
self.$addPlaceButton.hide();
self.$removePlaceButton.show();
}
})
.hide()
.appendTo(self.$placeStatusbar);
self.$revertPlaceButton = Ox.Button({
disabled: true,
title: 'Revert',
width: 64
width: 96
})
.css({float: 'right', margin: '4px'})
.hide()
.appendTo(self.$placeStatusbar);
/*
@ -525,6 +541,7 @@ Ox.ListMap = function(options, self) {
var country = place.id ? Ox.getCountryByGeoname(place.geoname) : '',
code = country ? country.code : 'NTHH';
if (place.id) {
isResult = place.id[0] == '_';
self.selectedPlace = place.id;
place.id[0] != '_' && self.$list.options({
selected: place.id ? [place.id] : []
@ -537,10 +554,18 @@ Ox.ListMap = function(options, self) {
self.$placeForm.values(Ox.map(place, function(val, key) {
return key == 'size' ? Ox.formatArea(val) : val;
})).show();
self.$newPlaceButton.hide();
self.$addPlaceButton[isResult ? 'show' : 'hide']();
self.$removePlaceButton[isResult ? 'hide' : 'show']();
self.$revertPlaceButton.options({disabled: true}).show();
} else {
self.selectedPlace = null;
self.$placeTitle.hide();
self.$placeForm.hide();
self.$newPlaceButton.show();
self.$addPlaceButton.hide();
self.$removePlaceButton.hide();
self.$revertPlaceButton.hide();
}
}