Wee 0.8.0 is out. Have fun!
Major changes are:
* Ajax support (live updates). See examples/ajax/ajax.rb.
* FastCGI adaptor (working but not fully tested)
* Fixed bug in callback processing.
For example, you can update a field with Ajax like this:
def render
r.div.id('field')
r.anchor.onclick_update('field') { update_field }.with('Click here')
end
def update_field
send_render_response {
r.text "Live update works!"
}
end
More? http://rubyforge.org/projects/wee
Regards,
Michael
> * Ajax support (live updates). See examples/ajax/ajax.rb.
That is great news. Is there some configuration needed? When I tried the
ajax.rb I got the 1st page fine, but when I click on the "Helloooo" I got:
undefined method `+' for
nil:NilClassC:/ruby/lib/ruby/gems/1.8/gems/wee-0.8.0/examples/ajax/ajax.rb:2
3:in `update'
C:/ruby/lib/ruby/gems/1.8/gems/wee-0.8.0/examples/ajax/ajax.rb:22:in
`with_renderer_for'
c:/ruby/lib/ruby/gems/1.8/gems/wee-0.8.0/lib/wee/core/presenter.rb:139:in
`send_render_response'
> * FastCGI adaptor (working but not fully tested)
Great news too!
> For example, you can update a field with Ajax like this:
>
> def render
> r.div.id('field')
> r.anchor.onclick_update('field') { update_field }.with('Click here')
> end
Does this block-form of callback assume continuations? Is the other form:
r.anchor.onclick_update('field', :update_field }.with('Click here')
the non-callback version?
Thanks!
Oops, sorry. @live_updates is not initialize... use this patch:
--- ajax.rb (revision 602)
+++ ajax.rb (working copy)
@@ -20,7 +20,7 @@
def update
send_render_response {
- r.text "Live-updates works! This is no. #{ @live_updates += 1}"
+ r.text "Live-updates works! This is no. #{ @live_updates =
(@live_updates || 0) + 1 }"
}
end
end
> > * FastCGI adaptor (working but not fully tested)
>
> Great news too!
>
> > For example, you can update a field with Ajax like this:
> >
> > def render
> > r.div.id('field')
> > r.anchor.onclick_update('field') { update_field }.with('Click here')
> > end
>
> Does this block-form of callback assume continuations? Is the other form:
> r.anchor.onclick_update('field', :update_field }.with('Click here')
> the non-callback version?
No, both do not involve continuations! The non-block form (:update_field) is
only for people that want to marshal the component state... blocks can't be
marshalled whereas symbols can.
Regards,
Michael
> Wee 0.8.0 is out. Have fun!
Any idea what might be causing my wee rdoc to not appear (alongside the rdoc
for other gems in gem_server) in this version? It was there for previous wee
gems. It could be I did something foolish (I did remove some wee directories
I found in my regular non-gem ruby lib directories prior to gem-installing
0.8.).
Thanks.
How does one update multiple DOM nodes in a single liveUpdate?
Thanks.
Simply because I did not generate the rdoc files for 0.8.0 (I had some not yet
ready-to-commit files in my tree that I did not want to show up). You can do
this yourself if you like with "rake rdoc".
Regards,
Michael
Good question. No problem from the Wee side, but I am not good enough in
Javascript to implement this. What I thought is, that Wee would generate a
document like:
<root>
<div id="id1"> .... content .... </div>
<div id="id2"> ..... content .... </div>
</root>
This would update the DOM nodes id1 and id2 with the content.
Anyone willing to hack this in javascript?
Regards,
Michael