If you *do* need optional editorId behavior, use the attached patch.

If you never used a diff file before, here's how to apply it on *nix or 
Windows with Cygwin:

* Open a shell
* Move to the directory with controls.js
* Run the following line

   $ patch -p0 < path/to/your_download_of/optional_editorid_param.diff

-- 
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Index: controls.js
===================================================================
--- controls.js (revision 8662)
+++ controls.js (working copy)
@@ -624,7 +624,8 @@
     var params = this.options.callback(form, value) || '';
     if (Object.isString(params))
       params = params.toQueryParams();
-    params.editorId = this.element.id;
+    if (this.element.id)
+      params.editorId = this.element.id;
     if (this.options.htmlResponse) {
       var options = Object.extend({ evalScripts: true }, 
this.options.ajaxOptions);
       Object.extend(options, {
@@ -668,7 +669,6 @@
     this._controls.editor.disabled = true;
     var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
     Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
       onComplete: Prototype.emptyFunction,
       onSuccess: function(transport) {
         this._form.removeClassName(this.options.loadingClassName);
@@ -681,6 +681,8 @@
       }.bind(this),
       onFailure: this._boundFailureHandler
     });
+    if (this.element.id)
+    options.parameters = 'editorId=' + encodeURIComponent(this.element.id) : ,
     new Ajax.Request(this.options.loadTextURL, options);
   },
   postProcessEditField: function() {
@@ -775,7 +777,6 @@
     this.showLoadingText(this.options.loadingCollectionText);
     var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
     Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
       onComplete: Prototype.emptyFunction,
       onSuccess: function(transport) {
         var js = transport.responseText.strip();
@@ -786,6 +787,8 @@
       }.bind(this),
       onFailure: this.onFailure
     });
+    if (this.element.id)
+      options.parameters = 'editorId=' + encodeURIComponent(this.element.id),
     new Ajax.Request(this.options.loadCollectionURL, options);
   },
 
@@ -813,7 +816,6 @@
     this.showLoadingText(this.options.loadingText);
     var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
     Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
       onComplete: Prototype.emptyFunction,
       onSuccess: function(transport) {
         this._text = transport.responseText.strip();
@@ -821,6 +823,8 @@
       }.bind(this),
       onFailure: this.onFailure
     });
+    if (this.element.id)
+      options.parameters = 'editorId=' + encodeURIComponent(this.element.id),
     new Ajax.Request(this.options.loadTextURL, options);
   },
 

Reply via email to