Hi Walter,
I'm using ActiveScaffold in fact, which one can configure to do
inline_editing, however you do now in Rails 2.0 have to install the
Rails "in_place_editing" plugin. So I think it's really
ActiveScaffold making the calls, which use the "in_place_editor"
plugin, that I'm guessing then use Prototype/Scriptaculus.
I traced the Javascript in Firebug and can confirm that the javascript
code does pass through both these prototype methods. The
"responseText" that gets passed into the evalResponse is:
"try {\nElement.update("expense-update_column-6-body-
cell", "try {\nElement.update(\u0026quot;expense-..." <== I THINK
FIREBUG TRUNCATED THIS
evalResponse: function() {
try {
return eval((this.transport.responseText ||
'').unfilterJSON()); <=== DOES INVOKE THIS
} catch (e) {
this.dispatchException(e); <== EXCEPTION IS CAUGHT HERE
}
},
update: function(element, content) {
element = $(element);
if (content && content.toElement) content = content.toElement();
if (Object.isElement(content)) return
element.update().insert(content);
content = Object.toHTML(content);
element.innerHTML = content.stripScripts();
content.evalScripts.bind(content).defer();
return element; <== DOES MAKE IT DOWN TO HERE
},
So it would seem the eval did see the javascript update was required,
it did call it,however it didn't seem to work properly?
Greg
On Apr 13, 12:51 am, Walter Lee Davis <[EMAIL PROTECTED]> wrote:
> No, you had it right. There are two sections to the Firebug headers
> message. The top part (oddly) is the Response, and that shows the
> correct javascript mime type.
>
> New tack: is the Updater instance set to evalScripts: true? (Look in
> the generated code, I have no idea how you set this using the Rails
> helper, but I'm sure it's something straightforward.)
>
> Walter
>
> On Apr 11, 2008, at 10:34 PM, Greg Hauptmann wrote:
>
> > actually I'm not sure that the output I just posted from firebug
> > was for the ajax response (it may have been for the page prior to
> > the in-line update I did). I just used HTTP Headers to capture the
> > return from the in-cell edit request:
>
> > It actually indicates the type was "Content-Type: text/javascript;
> > charset=utf-8" which is ok no?
>
> > ======http headers capture====
> > POST /expense/update_column/3?column=body HTTP/1.1
>
> > Host: 0.0.0.0:3000
>
> > User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:
> > 1.8.1.13) Gecko/20080311 Firefox/2.0.0.13
>
> > Accept: text/javascript, text/html, application/xml, text/xml, */*
>
> > Accept-Language: en-us,en;q=0.5
>
> > Accept-Encoding: gzip,deflate
>
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>
> > Keep-Alive: 300
>
> > Connection: keep-alive
>
> > X-Requested-With: XMLHttpRequest
>
> > X-Prototype-Version: 1.6.0.1
>
> > Content-Type: application/x-www-form-urlencoded; charset=UTF-8
>
> > Referer:http://0.0.0.0:3000/
>
> > Content-Length: 54
>
> > Cookie:
> > _test_rails2_session=BAh1ByIPYXM6ZXhwZW5zZXsGOglsaXN0ewAiCmZsYXNoSUM6J
> > 0FjdGlvbkNv%250AbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA%
> > 253D--fefd8df8ef2caa7cf88df9bf4d45fce81221ebd4
>
> > Pragma: no-cache
>
> > Cache-Control: no-cache
>
> > value=asdf2&editorId=expense-update_column-3-body-cell
>
> > HTTP/1.x 200 OK
>
> > Connection: close
>
> > Date: Sat, 12 Apr 2008 02:30:37 GMT
>
> > Status: 200 OK
>
> > X-Runtime: 0.01660
>
> > Etag: "997e4567663bb3eea753c40b8cc83e25"
>
> > Cache-Control: private, max-age=0, must-revalidate
>
> > Server: Mongrel 1.1.4
>
> > Content-Type: text/javascript; charset=utf-8
>
> > Content-Length: 207
>
> > ----------------------------------------------------------
>
> > On Sat, Apr 12, 2008 at 12:22 PM, Greg Hauptmann
> > <[EMAIL PROTECTED]> wrote:
> > Walter - content type seems to be "application/x-www-form-
> > urlencoded; charset=UTF-8"
>
> > Response Headers
> > Connection close
> > Date Sat, 12 Apr 2008 02:19:30 GMT
> > Status 200 OK
> > X-Runtime 0.50048
> > Etag "37eb7a26070f89e08008b7e9ae5eb79b"
> > Cache-Control private, max-age=0, must-revalidate
> > Server Mongrel 1.1.4
> > Content-Type text/javascript; charset=utf-8
> > Content-Length 207
> > Request Headers
> > Host 0.0.0.0:3000
> > User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:
> > 1.8.1.13) Gecko/20080311 Firefox/2.0.0.13
> > Accept text/javascript, text/html, application/xml, text/xml, */*
> > Accept-Language en-us,en;q=0.5
> > Accept-Encoding gzip,deflate
> > Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive 300
> > Connection keep-alive
> > X-Requested-With XMLHttpRequest
> > X-Prototype-Version 1.6.0.1
> > Content-Type application/x-www-form-urlencoded; charset=UTF-8
> > Referer http://0.0.0.0:3000/
> > Content-Length 54
> > Cookie
> > _test_rails2_session=BAh1CCIPYXM6ZXhwZW5zZXsGOglsaXN0ewA6DGNzcmZfaWQiJ
> > WZhZWFmNTA1%
> > 250AYmE1YWQ3YjZhMzYxNmNjMmFiNzU5NjY0IgpmbGFzaElDOidBY3Rpb25Db250%
> > 250Acm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--
> > cd864d26f4c43ac3987e0ce80e9f7719157ca249
> > Pragma no-cache
> > Cache-Control no-cache
>
> > On Sat, Apr 12, 2008 at 7:32 AM, Walter Lee Davis
> > <[EMAIL PROTECTED]> wrote:
>
> > okay, maybe the mime type that is being sent back is wrong -- the
> > browser is not recognizing this lump of script as script. When you
> > look at the response in Firebug, click on the Headers tab and see
> > what Content-type is set on the response.
>
> > Walter
>
> > On Apr 11, 2008, at 4:46 PM, greghauptmann wrote:
>
> > > I can reproduce the issue with firebug running and I don't see any
> > > firebug/client-side javascript errors being indicated....?
>
> > > On Apr 12, 4:53 am, Walter Lee Davis <[EMAIL PROTECTED]> wrote:
> > >> Have you tried using Firefox and Firebug to see if there are any
> > >> javascript errors being thrown?
>
> > >> Water
>
> > >> On Apr 11, 2008, at 2:09 PM, greghauptmann wrote:
>
> > >>> side rails log, HOWEVER instead of seeing the updated text in the
> > >>> cell
> > >>> I see the following:
>
> > >>> try {
> > >>> Element.update("expense-update_column-1-body-cell", "test12");
> > >>> } catch (e) { alert('RJS error:\n\n' + e.toString());
>
> > >>> alert('Element.update(\"expense-update_column-1-body-cell\",
> > >>> \"test12\");'); throw e }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---