add tooltips to map place info; fix a bug with autocomplete and live updates (fixes #453)

This commit is contained in:
rlx 2012-02-15 16:13:09 +00:00
parent 96db09337c
commit 972808eb17
4 changed files with 19 additions and 16 deletions

View file

@ -438,7 +438,7 @@ Ox.Input = function(options, self) {
})
.addClass('OxAutocompleteMenu')
.bindEvent({
click: clickMenu
click: clickMenu,
});
return menu;
}
@ -643,9 +643,7 @@ Ox.Input = function(options, self) {
self.$input.val(self.options.value);
cursor(0, self.options.value.length);
self.options.changeOnKeypress && that.triggerEvent({
change: {
value: self.options.value
}
change: {value: self.options.value}
});
}
@ -745,9 +743,7 @@ Ox.Input = function(options, self) {
self.options.autocomplete && autocomplete(oldValue, oldCursor);
self.options.autovalidate && autovalidate(oldValue, oldCursor);
self.options.changeOnKeypress && that.triggerEvent({
change: {
value: self.options.value
}
change: {value: self.options.value}
});
}
}, 0);
@ -773,6 +769,9 @@ Ox.Input = function(options, self) {
self.options.value = data.title
self.$input.val(self.options.value);
cursor(pos[0], self.options.value.length);
self.options.changeOnKeypress && that.triggerEvent({
change: {value: self.options.value}
});
//}
}

View file

@ -897,9 +897,9 @@ Ox.ListMap = function(options, self) {
function removeItem(data) {
var id = data.ids[0];
// fixme: events or callback functions??
self.$list.value(id, 'type') && self.$map.removePlace(id);
// FIXME: events or callback functions??
that.triggerEvent('removeplace', {id: id});
self.$map.removePlace(id);
}
function removePlace() {

View file

@ -415,7 +415,8 @@ Ox.Map = function(options, self) {
flag: Ox.Element()
.addClass('OxPlaceControl OxPlaceFlag'),
name: Ox.Label({
textAlign: 'center'
textAlign: 'center',
tooltip: 'Click to pan, doubleclick to zoom'
})
.addClass('OxPlaceControl OxPlaceName')
.bindEvent({
@ -428,6 +429,7 @@ Ox.Map = function(options, self) {
}),
deselectButton: Ox.Button({
title: 'close',
tooltip: 'Deselect',
type: 'image',
})
.addClass('OxPlaceControl OxPlaceDeselectButton')
@ -555,10 +557,7 @@ Ox.Map = function(options, self) {
function centerChanged() {
var tooltip = $('.OxMapMarkerTooltip');
if (tooltip.length) {
Ox.Log('Map', '??', tooltip[0].className, $(tooltip[0]).data('oxid'));
Ox.UI.elements[$(tooltip[0]).data('oxid')].hide();
}
tooltip.length && Ox.UI.elements[$(tooltip[0]).data('oxid')].hide();
self.center = self.map.getCenter();
self.centerChanged = true;
}

View file

@ -624,10 +624,15 @@ Ox.AnnotationFolder = function(options, self) {
});
self.options.selected = item.id;
self.$annotations.options({selected: self.options.selected});
if (self.widget && isDefined(item)) {
if (self.widget) {
self.options.type == 'event'
? self.$calendar.options({events: getEvents()})
: self.$map.options({places: getPlaces()});
// if updating has made the item match
// an event or place, then select it
self.$widget.options({selected: item[self.options.type].id});
isDefined(item) && self.$widget.options({
selected: item[self.options.type].id
});
}
return that;
};