From jari.bakken at gmail.com Thu Apr 2 08:56:22 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Thu, 2 Apr 2009 14:56:22 +0200 Subject: [Celerity-users] Suggestion: truncate Java stack trace In-Reply-To: <848C79F9-8084-451C-B773-DF88B58ADCA6@patchspace.co.uk> References: <0DE8D97A-D5B4-41C6-A90B-FF1A0508EEB3@patchspace.co.uk> <6795F72A-4880-43A6-B9A1-746131F78257@gmail.com> <848C79F9-8084-451C-B773-DF88B58ADCA6@patchspace.co.uk> Message-ID: On 27. mars. 2009, at 17.58, Ashley Moran wrote: > > Hmmm, I hadn't looked at the code, but I had a feeling it might be > hard to do. I guess it would be useful if you could make all HTTP > requests go through one point? (I really need to look at the source > to know if that's feasible...) > That's not really feasible from Celerity's point of view. I've added a rescue in the most obvious places: http://github.com/jarib/celerity/commit/260c56fb9a5ea8145ff1fd8a021328d43d712781 Please let me know how it works for you. From info at ninajansen.dk Thu Apr 2 11:15:23 2009 From: info at ninajansen.dk (Nina Jansen) Date: Thu, 2 Apr 2009 17:15:23 +0200 Subject: [Celerity-users] problem with celerity and in_place_editor Message-ID: Hi I hope someone can shed light on this problem: I have a problem when I use celerity to submit an in_place_editor_field in a rails application. I have attached a demo with a very small rails application that illustrates the problem. It's uses rails 2.3.2. In case zip files don't get sent to the mailing list, I have also uploaded it here: http://ninajansen.dk/wp-content/uploads/demo.zip unzip it in your favorite directory db:create db:migrate script/server Now you should be able to navigate to http://localhost:3000/foos/new Create a new foo, with any name. Then go to: http://localhost:3000/foos/1/edit Verify that you can use the in_place_editor to edit the name. The server output looks something like this: ----- Processing FoosController#set_foo_name (for 127.0.0.1 at 2009-04-02 16:45:24) [POST] Parameters: {"authenticity_token"=>"BZWAOGJBIc2DK0tz5voK0CAtQTmJlRzIUmKSjF19keo=", "id"=>"1", "value"=>"Name", "editorId"=>"foo_name_1_in_place_editor"} Foo Load (0.2ms) SELECT * FROM "foos" WHERE ("foos"."id" = 1) Completed in 5ms (View: 1, DB: 0) | 200 OK [ http://localhost/foos/set_foo_name/1] ----- Now, look at the celerity script I have put in script/celerity_demo.rb . It uses celerity to drive the in place editor. Run it with: jruby script/celerity_demo.rb The output from the server looks like this: ----- Processing FoosController#show (for 127.0.0.1 at 2009-04-02 16:46:47) [GET] Parameters: {"id"=>"1", "value"=>"New name"} Foo Load (0.2ms) SELECT * FROM "foos" WHERE ("foos"."id" = 1) Rendering template within layouts/foos Rendering foos/show Completed in 6ms (View: 2, DB: 0) | 200 OK [ http://localhost/foos/1/?value=New+name] ----- As you can see, by using celerity the http-request is wrong (it is a get request instead of a post, and it goes to "/foos/1/?value=New+name" instead of "/foos/set_foo_name/1") . I have also included a watir script, in script/watir_demo.rb (it uses safari watir). Run it with: ruby script/watir_demo.rb This works. This leads me to the conclusion that this must be a celerity problem. Can anyone that knows celerity help me out? Sincerely Nina Jansen -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: demo.zip Type: application/zip Size: 139013 bytes Desc: not available URL: From jari.bakken at gmail.com Thu Apr 2 12:27:31 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Thu, 2 Apr 2009 18:27:31 +0200 Subject: [Celerity-users] problem with celerity and in_place_editor In-Reply-To: References: Message-ID: > > As you can see, by using celerity the http-request is wrong (it is a > get request instead of a post, and it goes to "/foos/1/?value=New > +name" instead of "/foos/set_foo_name/1") . Try this: Celerity::Browser.new(:resynchronize => true) See http://wiki.github.com/jarib/celerity/ajax for details. Also, Browser#html will always show the HTML string from the original request of the page. If you want the current DOM representation (inluding changes made by JavaScript), try Browser#xml instead. From info at ninajansen.dk Thu Apr 2 14:14:18 2009 From: info at ninajansen.dk (Nina Jansen) Date: Thu, 2 Apr 2009 20:14:18 +0200 Subject: [Celerity-users] problem with celerity and in_place_editor In-Reply-To: References: Message-ID: Hi Jari No, doesn't make any difference. Still makes a get request to http://localhost/foos/1/?value=New+name instead of the correct request. Sincerely Nina On Thu, Apr 2, 2009 at 6:27 PM, Jari Bakken wrote: > >> As you can see, by using celerity the http-request is wrong (it is a get >> request instead of a post, and it goes to "/foos/1/?value=New+name" instead >> of "/foos/set_foo_name/1") . >> > > Try this: > > Celerity::Browser.new(:resynchronize => true) > > See http://wiki.github.com/jarib/celerity/ajax for details. > > Also, Browser#html will always show the HTML string from the original > request of the page. If you want the current DOM representation (inluding > changes made by JavaScript), try Browser#xml instead. > > > _______________________________________________ > Celerity-users mailing list > Celerity-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/celerity-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jari.bakken at gmail.com Thu Apr 2 17:38:40 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Thu, 2 Apr 2009 23:38:40 +0200 Subject: [Celerity-users] problem with celerity and in_place_editor In-Reply-To: References: Message-ID: <073F2530-0BAD-4111-9B3B-06C95BFA377E@gmail.com> On 2. april. 2009, at 20.14, Nina Jansen wrote: > Hi Jari > > No, doesn't make any difference. Still makes a get request to http://localhost/foos/1/?value=New+name > instead of the correct request. That's strange. It seems to work fine for me when setting that option: http://gist.github.com/89503 Notice the output from HtmlUnit: INFO: Re-synchronized call to http://localhost:3001/foos/set_foo_name/1 As you can see, running the original script gives me the URL parameters as well - not sure where those are coming from. Perhaps it's related to if the value was actually changed or not - Rails/ Scriptaculous will avoid the UPDATE db call if the new value is the same as the old one? From info at ninajansen.dk Thu Apr 2 18:17:46 2009 From: info at ninajansen.dk (Nina Jansen) Date: Fri, 3 Apr 2009 00:17:46 +0200 Subject: [Celerity-users] problem with celerity and in_place_editor In-Reply-To: <073F2530-0BAD-4111-9B3B-06C95BFA377E@gmail.com> References: <073F2530-0BAD-4111-9B3B-06C95BFA377E@gmail.com> Message-ID: Okay, yes, it does save the correct value (I turned log level all on as well, and I see the call). Thanks a lot, you've been very helpful. Another question: how can I verify that the page looks correct once I get back from the call? I want to check that the editor form is gone once the call has finished. But since the html the the browser variable is not that of the original page, but rather of something else, how can I check that the return page looks correct? Sincerely Nina On Thu, Apr 2, 2009 at 11:38 PM, Jari Bakken wrote: > > On 2. april. 2009, at 20.14, Nina Jansen wrote: > > Hi Jari >> >> No, doesn't make any difference. Still makes a get request to >> http://localhost/foos/1/?value=New+name instead of the correct request. >> > > That's strange. It seems to work fine for me when setting that option: > > http://gist.github.com/89503 > > Notice the output from HtmlUnit: INFO: Re-synchronized call to > http://localhost:3001/foos/set_foo_name/1 > > As you can see, running the original script gives me the URL parameters as > well - not sure where those are coming from. Perhaps it's related to if the > value was actually changed or not - Rails/Scriptaculous will avoid the > UPDATE db call if the new value is the same as the old one? > > > > > > > > > > _______________________________________________ > Celerity-users mailing list > Celerity-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/celerity-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jari.bakken at gmail.com Thu Apr 2 18:53:01 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Fri, 3 Apr 2009 00:53:01 +0200 Subject: [Celerity-users] problem with celerity and in_place_editor In-Reply-To: References: <073F2530-0BAD-4111-9B3B-06C95BFA377E@gmail.com> Message-ID: <153F883A-904D-4897-A584-4C176A0ACE13@gmail.com> On 3. april. 2009, at 00.17, Nina Jansen wrote: > Another question: how can I verify that the page looks correct once > I get back from the call? I want to check that the editor form is > gone once the call has finished. But since the html the the browser > variable is not that of the original page, but rather of something > else, how can I check that the return page looks correct? > Browser#html _does_ return the HTML of the original page. What you want is the state of the DOM tree after it has been manipulated by JavaScript (which you can get with Browser#xml). In any case, you should be using Celerity's API instead of the strings returned from these method to inspect the page. ## if the
is removed from the tree browser.form(:id, 'foo').exist? #=> false ## if it's hidden using CSS styles browser.form(:id, 'foo').visible? #=> false Using RSpec expectations this reads very well: browser.form(:id, 'foo').should_not exist browser.form(:id, 'foo').should_not be_visible Good luck! :) From ashley.moran at patchspace.co.uk Mon Apr 6 05:17:35 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Mon, 6 Apr 2009 10:17:35 +0100 Subject: [Celerity-users] Suggestion: truncate Java stack trace In-Reply-To: References: <0DE8D97A-D5B4-41C6-A90B-FF1A0508EEB3@patchspace.co.uk> <6795F72A-4880-43A6-B9A1-746131F78257@gmail.com> <848C79F9-8084-451C-B773-DF88B58ADCA6@patchspace.co.uk> Message-ID: <34A1D376-2429-4C47-A966-47A0788167F4@patchspace.co.uk> On 2 Apr 2009, at 13:56, Jari Bakken wrote: > That's not really feasible from Celerity's point of view. > I've added a rescue in the most obvious places: > > http://github.com/jarib/celerity/commit/260c56fb9a5ea8145ff1fd8a021328d43d712781 > > Please let me know how it works for you. Hi Jari Sorry I've not got back to you, been insanely busy. Soon as I get chance to test this out I'll provide feedback. Thanks for your time. Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ http://twitter.com/ashleymoran