From 3fa654a815f0fab5d9c7db16f7e2152b9e3c81e6 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 1 Oct 2011 13:51:03 +0000 Subject: [PATCH] fix a bug in map where the input element would not change its style when there are no results --- source/Ox.UI/js/List/Ox.List.js | 22 ++++++++++++---------- source/Ox.UI/js/Map/Ox.Map.js | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 7a0d314c..ac046178 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1289,19 +1289,21 @@ Ox.List = function(options, self) { //Ox.print('INIT!!!', result.data) that.triggerEvent('init', result.data); self.rowLength = getRowLength(); - self.pageLength = self.options.orientation == 'both' ? - self.pageLengthByRowLength[self.rowLength] : - self.options.pageLength; + self.pageLength = self.options.orientation == 'both' + ? self.pageLengthByRowLength[self.rowLength] + : self.options.pageLength; Ox.extend(self, { listLength: result.data.items, pages: Math.max(Math.ceil(result.data.items / self.pageLength), 1), - pageWidth: self.options.orientation == 'vertical' ? 0 : - (self.options.itemWidth + self.itemMargin) * - (self.options.orientation == 'horizontal' ? - self.pageLength : self.rowLength), - pageHeight: self.options.orientation == 'horizontal' ? 0 : - Math.ceil(self.pageLength * (self.options.itemHeight + - self.itemMargin) / self.rowLength) + pageWidth: self.options.orientation == 'vertical' + ? 0 : (self.options.itemWidth + self.itemMargin) * ( + self.options.orientation == 'horizontal' + ? self.pageLength : self.rowLength + ), + pageHeight: self.options.orientation == 'horizontal' + ? 0 : Math.ceil(self.pageLength * ( + self.options.itemHeight + self.itemMargin + ) / self.rowLength) }); self.listSize = getListSize(); that.$content.css( diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index 4050227f..28db688e 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -647,8 +647,8 @@ Ox.Map = function(options, self) { callback(new Ox.MapPlace(parseGeodata(results[0]))); } if ( - status == google.maps.GeocoderStatus.OK || - status == google.maps.GeocoderStatus.ZERO_RESULTS + status == google.maps.GeocoderStatus.OK + && status != google.maps.GeocoderStatus.ZERO_RESULTS ) { triggerGeocodeEvent({ address: name, @@ -1262,7 +1262,7 @@ Ox.Map = function(options, self) { addPlaceToMap(place); self.map.fitBounds(place.bounds); } else { - self.$findInput.addClass('OxError'); + name && self.$findInput.addClass('OxError'); } callback(place); });