diff options
author | Thomas Fuchs <thomas@fesch.at> | 2006-09-05 10:42:41 +0000 |
---|---|---|
committer | Thomas Fuchs <thomas@fesch.at> | 2006-09-05 10:42:41 +0000 |
commit | 4f68dcb035ef477ba10fc2719d0b6e612649deb0 (patch) | |
tree | 36c6e00645f9a9126f5707c95fccd7be234f517b /actionpack/lib/action_view/helpers/javascripts/controls.js | |
parent | 7cdd0d6ecf6afe0af98faf52e40b40deb5a15384 (diff) | |
download | rails-4f68dcb035ef477ba10fc2719d0b6e612649deb0.tar.gz rails-4f68dcb035ef477ba10fc2719d0b6e612649deb0.tar.bz2 rails-4f68dcb035ef477ba10fc2719d0b6e612649deb0.zip |
Update to script.aculo.us 1.6.3 [Thomas Fuchs]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5015 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/javascripts/controls.js')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/controls.js | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/controls.js b/actionpack/lib/action_view/helpers/javascripts/controls.js index ea5ce6eacd..8672b32809 100644 --- a/actionpack/lib/action_view/helpers/javascripts/controls.js +++ b/actionpack/lib/action_view/helpers/javascripts/controls.js @@ -48,7 +48,7 @@ Autocompleter.Base.prototype = { this.index = 0; this.entryCount = 0; - if (this.setOptions) + if(this.setOptions) this.setOptions(options); else this.options = options || {}; @@ -58,17 +58,20 @@ Autocompleter.Base.prototype = { this.options.frequency = this.options.frequency || 0.4; this.options.minChars = this.options.minChars || 1; this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight}); - } - Effect.Appear(update,{duration:0.15}); - }; + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight + }); + } + Effect.Appear(update,{duration:0.15}); + }; this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - if (typeof(this.options.tokens) == 'string') + if(typeof(this.options.tokens) == 'string') this.options.tokens = new Array(this.options.tokens); this.observer = null; @@ -274,9 +277,14 @@ Autocompleter.Base.prototype = { } this.stopIndicator(); - this.index = 0; - this.render(); + + if(this.entryCount==1 && this.options.autoSelect) { + this.selectEntry(); + this.hide(); + } else { + this.render(); + } } }, @@ -778,6 +786,8 @@ Object.extend(Ajax.InPlaceCollectionEditor.prototype, { collection.each(function(e,i) { optionTag = document.createElement("option"); optionTag.value = (e instanceof Array) ? e[0] : e; + if((typeof this.options.value == 'undefined') && + ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true; if(this.options.value==optionTag.value) optionTag.selected = true; optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e)); selectTag.appendChild(optionTag); |