From 358ee1bc96cdff63faa7b2cbba29f1d1ff89ce6e Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 27 Apr 2011 09:13:12 +0200 Subject: [PATCH] fix find on map --- source/css/Ox.UI.classic.css | 3 +++ source/css/Ox.UI.modern.css | 3 +++ source/js/Ox.UI/Form/Ox.Input.js | 1 + source/js/Ox.UI/Map/Ox.ListMap.js | 2 +- source/js/Ox.UI/Map/Ox.Map.js | 9 ++++++--- source/js/Ox.UI/Map/Ox.MapPlace.js | 1 + source/js/Ox.js | 4 +++- 7 files changed, 18 insertions(+), 5 deletions(-) diff --git a/source/css/Ox.UI.classic.css b/source/css/Ox.UI.classic.css index 01584a2d..a4e2876c 100644 --- a/source/css/Ox.UI.classic.css +++ b/source/css/Ox.UI.classic.css @@ -140,6 +140,9 @@ Forms background: -moz-linear-gradient(top, rgb(208, 208, 208), rgb(255, 255, 255)); background: -webkit-gradient(linear, left top, left bottom, from(rgb(208, 208, 208)), to(rgb(255, 255, 255))); } +.OxThemeClassic div.OxInput.OxError input { + color: rgb(192, 64, 64); +} .OxThemeClassic .OxInput:focus { //border: 1px solid rgb(160, 160, 160); //-moz-box-shadow: 0 0 2px rgb(128, 128, 128); diff --git a/source/css/Ox.UI.modern.css b/source/css/Ox.UI.modern.css index 3e599b47..386d7ed7 100644 --- a/source/css/Ox.UI.modern.css +++ b/source/css/Ox.UI.modern.css @@ -163,6 +163,9 @@ Forms background: -moz-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32)); background: -webkit-gradient(linear, left top, left bottom, from(rgb(0, 0, 0)), to(rgb(32, 32, 32))); } +.OxThemeModern div.OxInput.OxError input { + color: rgb(255, 64, 64); +} .OxThemeModern div.OxInput.OxFocus, .OxThemeModern .OxSelect.OxFocus { //border: 1px solid rgb(80, 80, 80); diff --git a/source/js/Ox.UI/Form/Ox.Input.js b/source/js/Ox.UI/Form/Ox.Input.js index 35b5d6a3..dbb5821b 100644 --- a/source/js/Ox.UI/Form/Ox.Input.js +++ b/source/js/Ox.UI/Form/Ox.Input.js @@ -593,6 +593,7 @@ Ox.Input = function(options, self) { return; } that.gainFocus(); + that.is('.OxError') && that.removeClass('OxError'); self.options.placeholder && setPlaceholder(); if (self.bindKeyboard) { //Ox.print('binding...') diff --git a/source/js/Ox.UI/Map/Ox.ListMap.js b/source/js/Ox.UI/Map/Ox.ListMap.js index 08003601..6aa58986 100644 --- a/source/js/Ox.UI/Map/Ox.ListMap.js +++ b/source/js/Ox.UI/Map/Ox.ListMap.js @@ -237,7 +237,7 @@ Ox.ListMap = function(options, self) { } function init(places) { - Ox.print('PLACES', places) + //Ox.print('PLACES', places) self.$map = new Ox.Map({ clickable: true, editable: true, diff --git a/source/js/Ox.UI/Map/Ox.Map.js b/source/js/Ox.UI/Map/Ox.Map.js index dd573943..d93f1b1c 100644 --- a/source/js/Ox.UI/Map/Ox.Map.js +++ b/source/js/Ox.UI/Map/Ox.Map.js @@ -1,4 +1,5 @@ // vim: et:ts=4:sw=4:sts=4:ft=js + Ox.Map = function(options, self) { var self = self || {} @@ -287,7 +288,7 @@ Ox.Map = function(options, self) { } }); if (!exists) { - self.resultPlace && self.resultPlace.removeElement(); + self.resultPlace && self.resultPlace.remove(); self.resultPlace = place; place.add(); } @@ -582,9 +583,9 @@ Ox.Map = function(options, self) { self.places.sort(function(a, b) { var sort = { a: a.selected ? Infinity : - (bounds.contains(a.center) ? a.size : -Infinity), + bounds.contains(a.center) ? a.size : -Infinity, b: b.selected ? Infinity : - (bounds.contains(b.center) ? b.size : -Infinity), + bounds.contains(b.center) ? b.size : -Infinity, }; return sort.b - sort.a; }).forEach(function(place, i) { @@ -878,6 +879,8 @@ Ox.Map = function(options, self) { if (place) { addPlaceToMap(place); self.map.fitBounds(place.bounds); + } else { + self.$findInput.addClass('OxError'); } callback(place); }); diff --git a/source/js/Ox.UI/Map/Ox.MapPlace.js b/source/js/Ox.UI/Map/Ox.MapPlace.js index ea4490d4..93f4da17 100644 --- a/source/js/Ox.UI/Map/Ox.MapPlace.js +++ b/source/js/Ox.UI/Map/Ox.MapPlace.js @@ -1,4 +1,5 @@ // vim: et:ts=4:sw=4:sts=4:ft=js + Ox.MapPlace = function(options) { options = Ox.extend({ diff --git a/source/js/Ox.js b/source/js/Ox.js index 6fe71975..f0170ce9 100644 --- a/source/js/Ox.js +++ b/source/js/Ox.js @@ -1260,6 +1260,8 @@ Ox.element = function(str) { Generic HTML element, mimics jQuery >>> Ox.element('div').attr({id: 'foo'}).attr('id') 'foo' + >>> Ox.element('div').css('color', 'red').css('color') + 'red' >>> Ox.element('div').html('foo').html() 'foo' */ @@ -1677,7 +1679,7 @@ Format functions */ Ox.formatArea = function(num, dec) { - return Ox.formatNumber(Ox.round(num / 1000000, dec)) + ' km²'; + return Ox.formatNumber(Ox.round(num / 1000000, dec)) + ' km\u00B2'; } Ox.formatColor = function() {