I've got these changes sitting in my tree:

diff --git a/public/javascripts/hobo-rapid.js b/public/javascripts/
hobo-rapid.js
index defac3d..beedc6f 100644
--- a/public/javascripts/hobo-rapid.js
+++ b/public/javascripts/hobo-rapid.js
@@ -1,3 +1,6 @@
+// WARNING:
+// Modified to accept extra behavior in AutocompleteBehavior.
+
 Object.extend = function(destination) {
     $A(arguments).slice(1).each(function (src) {
         for (var property in src) {
@@ -712,7 +715,7 @@ new HoboBehavior("ul.input-many", {
       } });

       ul.fire("rapid:change")
-  },
+  }
+  // fixes an IE parse problem where leaving the comma causes
problems.


@@ -801,13 +804,19 @@ AutocompleteBehavior = Behavior.create({
         var typedId   = target[0]
         var completer = target[1]

+        var options = {paramName:'query', method:'get', parameters:
parameters};
+        var select  = this.element.className.match(/autocomplete-
select::([\S]+)/)
+        if (select) options.select = select[1]
+
+        var afterUpdate = this.element.className.match(/autocomplete-
after-update-callback::([\S]+)/)
+        if (afterUpdate) options.afterUpdateElement = eval(afterUpdate
[1]);
+
         var spec = Hobo.parseModelSpec(typedId)
         var url = urlBase + "/" + Hobo.pluralise(spec.name) +  "/
complete_" + completer
         var parameters = spec.id ? "id=" + spec.id : ""
         new Ajax.Autocompleter(this.element,
                                this.element.next('.completions-
popup'),
-                               url,
-                               {paramName:'query', method:'get',
parameters: parameters});
+                               url, options);
     }
 })

The first hunk prevents IE7 from choking on the code. I suspect older
versions choke as well.

The 2nd hunk adds new behavior.  If you declare a <name-one
class="autocomplete-select::name/>, the Ajax.Autocompleter's select
option will be set.  Similarly for the afterUpdateElement callback.  I
haven't yet found another way of specifying those.

Any interest in me cleaning up and posting as a formal patch?

Thanks!
François
-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.


Reply via email to